could anyone give me the exact text i'd have to type into the python command line to make python check for integer solutions to:
Code:n = log[base2]((7^(x)-1)/(2^(x)-1))= log[base2](7^(x)-1) - log[base2](2^(x)-1)
what i want is the code i'd have to type into python to order it to look for integer solutions up to, say, n=10000, x=10000.
Last edited by Jaan; 07-07-2009 at 05:03 PM.
could anyone at least refer me to a guide which, if read thoroughly, would give me the answer i need?
none i have come across seem to offer answers about brute forcing...but someone on another forum claimed it was possible using python. they actually did it to an equation very similar to the one in my OP. but they ran off from the forum before i could ask them what could they typed into the command line...so i need some help from here.
I don't know Python so I don't know how the code would go but wouldn't you just type a few lines of code that will allow the end user to input a number which will be stored in the variable x. Then run that line of code with the value of x and then the answer would be stored in n.
Just print the value of n then?
jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation
Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!
To be honest I'm not sure what you are looking for. Do you want the program to try various values of x and see if n is an integer?
I've not used the maths module for python so I don't know how you'd go about entering your formula but you need a loop like this
unfortunately there is a problem with rounding error on floating point arithmetic ie if your function returns a value of 4.99999999999999999999 python will evaluate this to be 5.0 meaning the logic in the if statement above would return true. I'm not sure if there is a way round this problem.Code:for x in range(1,10001): n = log[base2]((7^(x)-1)/(2^(x)-1))= log[base2](7^(x)-1) - log[base2](2^(x)-1) if n-int(n) == 0: print x
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks