login
A246368
Permutation of natural numbers: a(n) = A227413(A005941(n)).
7
1, 2, 4, 3, 6, 7, 8, 5, 9, 13, 10, 17, 20, 19, 12, 11, 46, 23, 166, 41, 15, 29, 858, 59, 14, 71, 16, 67, 6186, 37, 58645, 31, 18, 199, 22, 83, 705348, 983, 32, 179, 10428487, 47, 184718194, 109, 21, 6659, 3840230006, 277, 27, 43, 65, 353
OFFSET
1,2
FORMULA
a(n) = A227413(A005941(n)) = A227413(1+A156552(n)).
Other identities:
For all n >= 1, A010051(a(n)) = 1 - A000035(n). [This permutation maps even numbers to primes and odd numbers to nonprimes, in some order, because the permutation A227413 has the same property and A005941 preserves the parity].
PROG
(Scheme) (define (A246368 n) (A227413 (A005941 n)))
(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)};
A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n))));
A005941(n) = A156552(n)+1;
A227413(n) = if(1==n, 1, if(!(n%2), prime(A227413(n/2)), A002808(A227413((n-1)/2))));
for(n=1, 52, write("b246368.txt", n, " ", A246368(n)));
CROSSREFS
Inverse: A246367.
Similar or related permutations: A005941, A156552, A227413, A246364, A246366.
Sequence in context: A361995 A126714 A035506 * A316963 A320672 A367262
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 26 2014
STATUS
approved