September 15th, 2012, 11:50 AM

Please help!!!
I am trying to write a code to output a certain value (y) when given a value (x). It is something like as x increases by 1, y increases by the previous y value doubled. In other words, if x=2001 and y=32, when x=2002, y=64, when x=2003, y=128. How would I program something like this. Thanks.
September 15th, 2012, 12:33 PM

You need to ask a specific question, and you also need to show the code that you have currently.
September 15th, 2012, 04:09 PM

mathematically, given x0 and y0 you want to find y given x.
It's perhaps
y0 * 2 raised to the power of (xx0)
x0 is 2001
y0 is 32
what is y when x is 2003?
32 * (2 raised to the power of (20032001))
32 * 4 is 128
The formula tests correctly.
[code]
Code tags[/code] are essential for python code and Makefiles!
September 15th, 2012, 05:11 PM

Originally Posted by DHulse94
It is something like as x increases by 1, y increases by the previous y value doubled.
It is something like y = y0*2**(xx0).