OFFSET
1,2
COMMENTS
Because 2 is the only even prime, it implies that, apart from a(2)=3, odd numbers occur in odd positions only (along with many even numbers that also occur in odd positions). This in turn implies that each odd composite (A071904) resides in a separate infinite cycle in this permutation, except 9, which is in a finite cycle (2 3 9 4).
LINKS
FORMULA
PROG
(PARI)
default(primelimit, (2^31)+(2^30));
A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
A246379(n) = if(1==n, 1, if(isprime(n), A003961(1+A246379(primepi(n))), 2*A246379(n-primepi(n)-1)));
for(n=1, 10000, write("b246379.txt", n, " ", A246379(n)));
(Scheme, with memoization-macro definec)
CROSSREFS
Inverse: A246380.
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 29 2014
STATUS
approved