%I #9 Aug 08 2014 09:00:00
%S 1,3,2,6,5,4,13,8,21,15,23,16,7,25,10,12,41,18,19,64,9,22,11,49,14,26,
%T 77,39,37,34,263,105,38,30,88,70,29,33,28,133,17,54,73,126,51,462,53,
%U 60,24,66,45,74,47,42,78,94,156,81,239,48,97,62,100,20,155,50,79,98,84,36,167,141,43,52,129,164,27,55
%N Self-inverse permutation of natural numbers, A245703-conjugate of Blue code: a(n) = A245704(A193231(A245703(n))).
%H Antti Karttunen, <a href="/A244987/b244987.txt">Table of n, a(n) for n = 1..10001</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F a(n) = A245704(A193231(A245703(n))).
%F Other identities. For all n >= 1, the following holds:
%F A010051(a(n)) = A010051(n). [Maps primes to primes and composites to composites].
%o (PARI)
%o allocatemem(234567890);
%o default(primelimit, 2^22);
%o A014580 = vector(2^18);
%o A091226 = vector(2^22);
%o A091242 = vector(2^22);
%o A002808(n)={ my(k=-1); while( -n + n += -k + k=primepi(n), ); n}; \\ This function from _M. F. Hasler_
%o isA014580(n)=polisirreducible(Pol(binary(n))*Mod(1, 2)); \\ This function from _Charles R Greathouse IV_
%o i=0; j=0; n=2; while((n < 2^22), if(isA014580(n), i++; A014580[i] = n; A091226[n] = A091226[n-1]+1, j++; A091242[j] = n; A091226[n] = A091226[n-1]); n++);
%o A091245(n) = ((n-A091226[n])-1);
%o A245703(n) = if(1==n, 1, if(isprime(n), A014580[A245703(primepi(n))], A091242[A245703(n-primepi(n)-1)]));
%o A245704(n) = if(1==n, 1, if(isA014580(n), prime(A245704(A091226[n])), A002808(A245704(A091245(n)))));
%o A193231(n) = {my(x='x); subst(lift(Mod(1, 2)*subst(Pol(binary(n), x), x, 1+x)), x, 2)};
%o A244987(n) = A245704(A193231(A245703(n)));
%o for(n=1, 10001, write("b244987.txt", n, " ", A244987(n)));
%o (Scheme) (define (A244987 n) (A245704 (A193231 (A245703 n))))
%Y Cf. A000040, A002808, A010051, A193231, A245703, A245704, A234747, A234748, A245450, A245454.
%K nonn
%O 1,2
%A _Antti Karttunen_, Aug 07 2014