# Math Trick Program Error Plz Help

## Recommended Posts

I tried to make a basic math trick to work on my computer. The trick works like this.

You tell someone to think of a four digit #. Tell them they cant show u and say write it on a piece of paper.

You tell them to jumble those digits to make a new #. write this on the paper as well.

Subtract the smaller # from the larger # to make a new number. write the new number down.

Now circle one of the digits in the new number but u cant circle 0 because they r already circles.

Remove the circled digit. Then show those left over numbers to me.

Now you say i know wat number u circled.

Now u add the leftover digits together lets say this is A. -If the sum(A) is below 9 then subtract A from 9. (this answer is the number they circled.)

- If the sum(A) is below 18(above 9) then subtract A from 18.(this answer is the number they circled)

- If the sum(A) is below 27 (above 18) then subtract A from 27.(this answer is the number they circled)

- if the sum(A) is equal 9, 18 or 27 then the number they circled is 9 (or 0 if they cheated.)

Im not sure how it works but it does.

ex.A) 5476-4567=0909

0(9)09

left over = 009

0 + 0 + 9 = 9 they removed a 9.

ex. 7429-4972=2457

24(5)7

leftover = 247

2+4+7 = 13

18-13 = 5

they removed a 5.

Now i made a basic script so i dont have to go through the process of doing tricks to friends. My PC can do it for me but it's not working.

Ex. A) will end up as 918

Ex.= equals 514

notice the two added digits equal the first digit?

9 1+8

5 1+4

I dont understand PLZ HELP?

If you figure it out plz email x_shadow_x21@hotmail.com with the correct script plz. I will be very thankful and if u can explain what i did wrong so i will learn from my mistakes. TY

I'll copy paste my script.

MsgBox(0,"title", "Think of a four digit number.")

MsgBox(0,"title", "Now Rearrange that number to make a different number.")

MsgBox(0,"title", "Now subtract the smaller of the two numbers from the larger number.")

MsgBox(0,"title", "Now circle one of the numbers in your answer. Do not circle a zero because it is already a circle.")

\$number3=Inputbox("question", "Please type in your third leftover digit.(leave blank if there was no third digit)")

Sleep(1000)

Sleep(2000)

Send("The number you circled was:")

\$var=\$number1+ \$number2+ \$number3

IF \$var<9 Then Send(9-\$var)

IF \$var<18 Then Send(18-\$var)

IF \$var<27 Then Send(27-\$var)

IF \$var=9 or \$var = 18 or \$var = 27 Then Send(9)

Edited by Dtvscrotes

##### Share on other sites

I tried to make a basic math trick to work on my computer. The trick works like this.

You tell someone to think of a four digit #. Tell them they cant show u and say write it on a piece of paper.

You tell them to jumble those digits to make a new #. write this on the paper as well.

Subtract the smaller # from the larger # to make a new number. write the new number down.

Now circle one of the digits in the new number but u cant circle 0 because they r already circles.

Remove the circled digit. Then show those left over numbers to me.

Now you say i know wat number u circled.

Now u add the leftover digits together lets say this is A. -If the sum(A) is below 9 then subtract A from 9. (this answer is the number they circled.)

- If the sum(A) is below 18(above 9) then subtract A from 18.(this answer is the number they circled)

- If the sum(A) is below 27 (above 18) then subtract A from 27.(this answer is the number they circled)

- if the sum(A) is equal 9, 18 or 27 then the number they circled is 9 (or 0 if they cheated.)

Im not sure how it works but it does.

ex.A) 5476-4567=0909

0(9)09

left over = 009

0 + 0 + 9 = 9 they removed a 9.

ex. 7429-4972=2457

24(5)7

leftover = 247

2+4+7 = 13

18-13 = 5

they removed a 5.

Now i made a basic script so i dont have to go through the process of doing tricks to friends. My PC can do it for me but it's not working.

Ex. A) will end up as 918

Ex.= equals 514

notice the two added digits equal the first digit?

9 1+8

5 1+4

I dont understand PLZ HELP?

If you figure it out plz email x_shadow_x21@hotmail.com with the correct script plz. I will be very thankful and if u can explain what i did wrong so i will learn from my mistakes. TY

I'll copy paste my script.

MsgBox(0,"title", "Think of a four digit number.")

MsgBox(0,"title", "Now Rearrange that number to make a different number.")

MsgBox(0,"title", "Now subtract the smaller of the two numbers from the larger number.")

MsgBox(0,"title", "Now circle one of the numbers in your answer. Do not circle a zero because it is already a circle.")

\$number3=Inputbox("question", "Please type in your third leftover digit.(leave blank if there was no third digit)")

Sleep(1000)

Sleep(2000)

Send("The number you circled was:")

\$var=\$number1+ \$number2+ \$number3

IF \$var<9 Then Send(9-\$var)

IF \$var<18 Then Send(18-\$var)

IF \$var<27 Then Send(27-\$var)

IF \$var=9 or \$var = 18 or \$var = 27 Then Send(9)

The script returns 9189 (NOT 918 AS YOU SAY) because you have asked it to without realising.

The value of \$var is 9 so

IF \$var<9 Then Send(9-\$var) ;not less than 9 so ignore

IF \$var<18 Then Send(18-\$var) ;less than 18 so send 9

IF \$var<27 Then Send(27-\$var) ;less than 27 so send 18

IF \$var=9 or \$var = 18 or \$var = 27 Then Send(9); = 9 so send 9

What you need is nore like

```IF \$var=9 or \$var = 18 or \$var = 27 Then
Send(9)
ElseIf
\$var<9 Then
Send(9-\$var)
ElseIF \$var<18 Then
Send(18-\$var)
ElseIF \$var<27 Then
Send(27-\$var)
EndIf```

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

##### Share on other sites

there r still extra digits on the end of the answer

Edited by Dtvscrotes

##### Share on other sites

there r still extra digits on the end of the answer

This is the code you posted, except that I've changed the end part as I indicated in my reply. I don't get any extra digits.

```MsgBox(0,"title", "Think of a four digit number.")
MsgBox(0,"title", "Now Rearrange that number to make a different number.")
MsgBox(0,"title", "Now subtract the smaller of the two numbers from the larger number.")
MsgBox(0,"title", "Now circle one of the numbers in your answer. Do not circle a zero because it is already a circle.")
\$number3=Inputbox("question", "Please type in your third leftover digit.(leave blank if there was no third digit)")
Sleep(1000)
Sleep(2000)
Send("The number you circled was:")
\$var=\$number1+ \$number2+ \$number3
#cs
;This section is from you original post
IF \$var<9 Then Send(9-\$var)
IF \$var<18 Then Send(18-\$var)
IF \$var<27 Then Send(27-\$var)
IF \$var=9 or \$var = 18 or \$var = 27 Then Send(9)

#ce
;Replaced with this bit below
IF \$var=9 or \$var = 18 or \$var = 27 Then
Send(9)
ElseIf \$var<9 Then
Send(9-\$var)
ElseIF \$var<18 Then
Send(18-\$var)
ElseIF \$var<27 Then
Send(27-\$var)
EndIf```

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

##### Share on other sites

Ty Martin

This seems to works with the once ive tested it with so TY.

## Create an account

Register a new account

×

• Wiki

• Back

• Git