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 == Product_{j=0..i and d_j > 0} d_j (mod prime(i+1)).
This sequence is a permutation of the nonnegative integers with inverse A305463.
The fixed points of this sequence (A305462) correspond to the numbers with all digits, except possibly the leading digit, equal to zero or one in primorial base.
Like A289234, this sequence preserves the number of digits and the number of nonzero digits in primorial base.
For any prime number p:
- we can build an analog of this sequence, say f_p, for the base p,
- in particular, f_2 = A001477,
- f_p is a permutation of the nonnegative integers,
- f_p preserves the number of digits and the number of nonzero digits in base p,
- the fixed points of f_p correspond to the numbers with all digits, except possibly the leading digit, equal to zero or one in base p.
LINKS
EXAMPLE
The digits of 7772 in primorial base are 3,4,0,0,1,0.
Also:
- 1 == 1 (mod prime(2)),
- 4 * 1 == 4 (mod prime(5)),
- 3 * 4 * 1 == 12 (mod prime(6)).
Hence the digits of a(7772) in primorial base are 12,4,0,0,1,0, and a(7772) = 28562.
PROG
(PARI) a(n) = my (v=0, k=1, r=2, p=1); while (n, my (d=n % r); if (d, k *= d; v += p * lift(Mod(k, r))); n \= r; p *= r; r = nextprime(r+1)); return (v)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 01 2018
STATUS
approved