Here is an expression in computer code (Python, to be precise). Here, n
is the position of the number in your sequence, staring with 1
. The result of this expression is the n
th value in your sequence.
10 ** ((n+4)//3) * 2 ** ((n+4)%3) // 4
As you can see by the // 3
and % 3
in that expression, this works by dividing your sequence into groups of three: 25, 50, 100
, 250, 500, 1000
, etc. My expression calculates the last value in that group of three, which is a power of 10
. Then my expression multiplies by an appropriate fractional factor, one of 1/4, 2/4, 4/4
. That multiplication by a fraction is done by multiplying by the numerator, which is a power of 2
, then dividing by 4
.
Note that n+4
is used twice. Many programming languages, including Python, have the divmod
function that does the //
(integer division) and %
(integer modulus) operations simultaneously. If you are using a function to calculate, using divmod
could make the function easier to understand and perhaps slightly faster. Also note that I chose this expression since it is fairly easy to translate to other computing environments. If your environment does not have the //
or %
operation those can be done with the int
or trunc
or similar function. Ask if you need help translating my expression to another environment.
Printing the first 12 values of that sequence (n
is 1
through 12
) results in
10
25
50
100
250
500
1000
2500
5000
10000
25000
50000