login
A245450
Self-inverse permutation of natural numbers, A245703-conjugate of balanced bit-reverse: a(n) = A245704(A057889(A245703(n))).
5
1, 2, 3, 4, 5, 6, 13, 8, 9, 10, 19, 12, 7, 14, 15, 16, 53, 18, 11, 20, 21, 22, 23, 24, 25, 26, 27, 33, 41, 30, 113, 32, 28, 34, 35, 36, 47, 39, 38, 92, 29, 54, 163, 85, 45, 462, 37, 60, 49, 70, 51, 94, 17, 42, 55, 74, 57, 156, 193, 48, 101, 62, 115, 64, 259, 77, 73, 132, 69, 50, 181, 102, 67, 56, 169, 76, 66, 78, 137, 87, 180, 398, 139, 84, 44
OFFSET
1,2
FORMULA
a(n) = A245704(A057889(A245703(n))).
Other identities. For all n >= 1, the following holds:
A010051(a(n)) = A010051(n). [Maps primes to primes and composites to composites].
PROG
(PARI)
allocatemem(234567890);
default(primelimit, 2^22);
A014580 = vector(2^18);
A091226 = vector(2^22);
A091242 = 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
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++);
A091245(n) = ((n-A091226[n])-1);
A245703(n) = if(1==n, 1, if(isprime(n), A014580[A245703(primepi(n))], A091242[A245703(n-primepi(n)-1)]));
A245704(n) = if(1==n, 1, if(isA014580(n), prime(A245704(A091226[n])), A002808(A245704(A091245(n)))));
A057889(n) = if(n<1, 0, 2^valuation(n, 2) * subst(Polrev(binary(n / 2^valuation(n, 2))), x, 2));
for(n=1, 10080, write("b245450.txt", n, " ", A245450(n)));
(Scheme) (define (A245450 n) (A245704 (A057889 (A245703 n))))
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 07 2014
STATUS
approved