OFFSET
0,2
COMMENTS
Note the indexing: the domain starts from 0, while the range excludes zero.
Iterating a(n) from n=0 gives the sequence: 1, 2, 3, 5, 7, 9, 8, 10, 14, 18, 28, 56, 128, 156, 1344, 16524, 2706412500, ..., which is the only one-way cycle of this permutation.
Because 2 is the only even prime, it implies that, apart from a(0)=1 and 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 there exists an infinite number of infinite cycles like (... 648391 31 13 15 20 22 30 42 112 196 1350 ...) which contain just one odd composite (A071904). Apart from 9 which is in that one-way cycle, each odd composite occurs in a separate infinite two-way cycle, like 15 in the example above.
LINKS
FORMULA
a(0) = 1, a(1) = 2, and for n > 1, if A010051(n) = 1 [i.e. when n is a prime], a(n) = A003961(a(A000720(n))), otherwise a(n) = 2*a(A065855(n)).
Other identities.
For all n >= 0, the following holds:
For all n >= 1, the following holds:
PROG
CROSSREFS
Inverse: A246682.
KEYWORD
nonn,look
AUTHOR
Antti Karttunen, Sep 01 2014
STATUS
approved