OFFSET
0,3
COMMENTS
For a number n >= 0, let d_k, ..., d_0 be the digits of n in primorial base (n = Sum_{i=0..k} d_i * A002110(i), and for i=0..k, 0 <= d_i < prime(i+1)); the digits of a(n) in primorial base, say e_k, ..., e_0, satisfy: for i=0..k:
- if d_i = 0, then e_i = 0,
- if d_i > 0, then e_i is the inverse of d_i mod prime(i+1) (in other words, 1 <= e_i < prime(i+1) and e_i * d_i = 1 mod prime(i+1)).
This sequence is a self-inverse permutation of the nonnegative numbers.
a(n) = n iff the digits of n in primorial base, say d_k, ..., d_0, satisfy: for i=0..k: d_i = 0, 1 or prime(i+1)-1.
For k > 0: the plotting of the first A002110(k) terms can be obtained by arranging prime(k) copies of the plotting of the first A002110(k-1) terms in a prime(k) X prime(k) grid:
- one copy in the cell at position (0,0),
- one copy in any cell at position (i,j) with i*j = 1 mod prime(k) (with 0 < i < prime(k) and 0 < j < prime(k)).
LINKS
FORMULA
EXAMPLE
The digits of 7772 in primorial base are 3,4,0,0,1,0.
Also:
- 9 * 3 = 27 = 1 mod prime(6) = 13,
- 3 * 4 = 12 = 1 mod prime(5) = 11,
- 1 * 1 = 1 mod prime(2) = 3.
Hence, the digits of a(7772) in primorial base are 9,3,0,0,1,0,
and a(7772) = 9 * 11# + 3 * 7# + 1 * 2# = 21422.
PROG
(PARI) a(n) = my (pr=1, p=2, v=0); while (n>0, my (d=n%p); if (d>0, v += pr * lift(1/Mod(d, p))); pr *= p; n \= p; p = next prime(p+1)); return (v)
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Jun 28 2017
STATUS
approved