OFFSET
1,2
COMMENTS
All the permutations A091203, A091205, A106443, A106445, A106447, A235042 share the same property that the binary representations of irreducible GF(2) polynomials (A014580) are mapped bijectively to the primes (A000040) but while they determine the mapping of corresponding reducible polynomials (A091242) to the composite numbers (A002808) by a simple multiplicative rule, this permutation employs index-recursion also in that case.
LINKS
FORMULA
a(1) = 1, after which, if A091225(n) is 1 [i.e. n is in A014580], then a(n) = A000040(a(A091226(n))), otherwise a(n) = A002808(a(A091245(n))).
As a composition of related permutations:
Other identities. For all n >= 1, the following holds:
PROG
(PARI)
allocatemem(123456789);
default(primelimit, 2^22)
A091226 = vector(2^22);
A002808(n)={ my(k=-1); while( -n + n += -k + k=primepi(n), ); n}; \\ This function from M. F. Hasler
isA014580(n)=polisirreducible(Pol(binary(n))*Mod(1, 2)); \\ This function from Charles R Greathouse IV
j=0; n=2; while((n < 2^22), if(isA014580(n), A091226[n] = A091226[n-1]+1, A091226[n] = A091226[n-1]); n++)
A245704(n) = if(1==n, 1, if(isA014580(n), prime(A245704(A091226[n])), A002808(A245704(A091245(n)))));
for(n=1, 10001, write("b245704.txt", n, " ", A245704(n)));
(Scheme, with memoization-macro definec)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 02 2014
STATUS
approved