OFFSET
1,2
COMMENTS
a(n) is built digit-by-digit as a_i ... a_3 a_2 a_1.
Note that in this case, the definition of "digit" is a nonnegative integer. If i > 3, the number of digits of a_i may be greater than 1.
Successively, we have:
a_1 = n mod 6;
a_2 = ((n - a_1)/primorial(2)) mod prime(2+1);
a_3 = ((n - a_1 - a_2*primorial(2))/primorial(3)) mod prime(3+1);
...
a_i = ((n - a_1 - a_2*primorial(2)-...-a_(i-1)*primorial(i-1))/primorial(i)) mod prime(i+1).
So that finally, n = a_1 + a_2*primorial(2) + ... + a_i*primorial(i).
LINKS
Lear Young, Table of n, a(n) for n = 1..100000
EXAMPLE
a(2287) = 10611.
10611 is built digit-by-digit as a_4 a_3 a_2 a_1 = 10 6 1 1.
And a_1 + a_2*primorial(2) + a_3*primorial(3) + a_4*primorial(4) = 1 + 1*6 + 6*30 + 10*210 = 2287.
(The definition of "digit" is a nonnegative integer. See comments for how to get a_1, a_2, a_3, a_4.)
PROG
(Sage)
Pr = Primes()
c = oeis(2110)[:10]
def bjz(a):
d = len(str(a)) + 1
b = [0] * (d)
b[0] = a % 6
s = 0
for x in range(1, d):
if x > 1:
s += c[x] * b[x-1]
b[x] = ((a - b[0] - s) / c[x+1] ) % Pr.unrank(x+1)
return int(''.join(map(str, b[::-1])))
[ bjz(x) for x in range(1, 101)] # Lear Young, Apr 17 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Lear Young, Apr 17 2014
STATUS
approved