OFFSET
1,2
COMMENTS
Has an infinite number of infinite cycles. See comments in A246379.
LINKS
FORMULA
a(1) = 1, a(2n) = nthcomposite(a(n)), a(2n-1) = nthprime(a(A064989(2n-1)-1)), where nthprime = A000040, nthcomposite = A002808, and A064989(n) shifts the prime factorization of n one step towards smaller primes.
As a composition of related permutations:
Other identities. For all n > 1 the following holds:
PROG
(PARI)
default(primelimit, (2^31)+(2^30));
A002808(n) = { my(k=-1); while( -n + n += -k + k=primepi(n), ); n }; \\ This function from M. F. Hasler
A064989(n) = {my(f); f = factor(n); if((n>1 && f[1, 1]==2), f[1, 2] = 0); for (i=1, #f~, f[i, 1] = precprime(f[i, 1]-1)); factorback(f)};
for(n=1, 3098, write("b246380.txt", n, " ", A246380(n)));
(Scheme, with memoization-macro definec)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 29 2014
STATUS
approved