help in something i wanna do

Blitz3D Forums/Blitz3D Beginners Area/help in something i wanna do

ngi(Posted 2004) [#1]
Hello , I want to make a program that finds how to find a number ,I'll give an example : I want 8 to be multiplied divided substracted or added to 8 , then do the same to the result 8 times until it gives me 600 , what I want to find is what the operations must be to get this number.
Ive been having a hard time trying to make this program and no success heh im new btw +) thx.

hope u understand what I want to do since i didnt kno how to say it well ... anyways any tips would be appreciated =)

tx


_PJ_(Posted 2004) [#2]
Hmmm not entirely clear on what you want.

The quickest way to find a number is to test => or <= at halfway points because then each test is 50/50 (your best odds)

This relies on knowing the absolute maximum and minimum values however.


For instance If I know the number is:


0 - 20

let's imagine the 'secret' number is '6'

first off
>= 10?

:no

so I know it is 0-9

next...

>=5?

:Yes


So now I know the number is 5 - 9

>=7?

:no

I have reduced the query to just 5 or 6

=5?

:no

I have deduced the number is 6.


Not sure if this helps at all..............


Warren(Posted 2004) [#3]
Sounds like homework. :)


Perturbatio(Posted 2004) [#4]
you might want to start by finding the largest power of 8 that is below 600, then see what you have left.
doing it in my head: (8*8*8 = 512) + (8*8 = 64) + (8+8+8 = 24) = 600


ngi(Posted 2004) [#5]
heh thats nice but how can I make that into a program?? I already knew what the answer was heh but I want to make it a program +) any thoughts???


WolRon(Posted 2004) [#6]
Is what Perturbbatio described, what you wanted?

If not, then try redescribing the problem in a different way.


SoggyP(Posted 2004) [#7]
Hi Folks,

I think Epic got it right, and what he means is "do your own homework!"

Later,

Jes


Perturbatio(Posted 2004) [#8]

any thoughts???


I think you should find the largest power that will fit into the final number, then the largest the will fit into the final number minus your previous result and so on.

Not particularly difficult to code


ngi(Posted 2004) [#9]
yeah thats what I want what he describerd , remember i am just a noob +))) any help plz ive been trying


Bremer(Posted 2004) [#10]
Try and post the code you have so far, this way its easier to figure out where you are going wrong. Don't expect someone to make the code for you, but I am sure plenty will be ready to help you tweak your code where needed.


Ice9(Posted 2004) [#11]
While 8*x<600
x=x+1
Wend
Print x
Print x*8
WaitKey

Where's my A

Would that even be pre-algebra


ngi(Posted 2004) [#12]
I cant even start lol I dont want any1 do it for me I just want some tips regarding how to do it...


eBusiness(Posted 2004) [#13]
The easy way is to just try all of the possible combinations, for this exact task your computer should be able to handle the calculations virtually instantly. Use a self calling function, there are 31 solutions.


Perturbatio(Posted 2004) [#14]
Is this what you want to do? (executable only)

I do the following:
Find highest power of divider * divider that will fit into the max num (repeat until you can't anymore), then find the result of the remainder divided by the divider.


Perturbatio(Posted 2004) [#15]
If you're still unsure of where to start, get a pencil and a piece of paper (and maybe a calculator if your head maths is poor).
Perform the calculations you require on paper on four or five sets of numbers.
Note down what you did exactly to achieve the result.
Then convert it to Blitz