login
A246380
Permutation of natural numbers: a(1) = 1, a(2n) = nthcomposite(a(n)), a(2n-1) = nthprime(a(A064989(2n-1)-1)), where nthprime = A000040, nthcomposite = A002808, and A064989(n) shifts the prime factorization of n one step towards smaller primes.
6
1, 4, 2, 9, 7, 6, 23, 16, 3, 14, 13, 12, 43, 35, 17, 26, 37, 8, 101, 24, 5, 22, 19, 21, 53, 62, 83, 51, 79, 27, 233, 39, 191, 54, 149, 15, 103, 134, 11, 36, 47, 10, 151, 34, 41, 30, 29, 33, 73, 75, 241, 86, 113, 114, 89, 72, 1153, 108, 443, 40, 593, 296, 547, 56, 167, 245, 173, 76, 563, 194, 1553, 25
OFFSET
1,2
COMMENTS
Has an infinite number of infinite cycles. See comments in A246379.
FORMULA
a(1) = 1, a(2n) = nthcomposite(a(n)), a(2n-1) = nthprime(a(A064989(2n-1)-1)), where nthprime = A000040, nthcomposite = A002808, and A064989(n) shifts the prime factorization of n one step towards smaller primes.
As a composition of related permutations:
a(n) = A246378(A246376(n)).
Other identities. For all n > 1 the following holds:
A010051(a(n)) = A000035(n). [Maps odd numbers larger than one to primes, and even numbers to composites, in some order. Permutations A246378 & A246682 have the same property].
PROG
(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)};
A246380(n) = if(1==n, 1, if(!(n%2), A002808(A246380(n/2)), prime(A246380(A064989(n)-1))));
for(n=1, 3098, write("b246380.txt", n, " ", A246380(n)));
(Scheme, with memoization-macro definec)
(definec (A246380 n) (cond ((< n 2) n) ((even? n) (A002808 (A246380 (/ n 2)))) (else (A000040 (A246380 (- (A064989 n) 1))))))
CROSSREFS
Inverse: A246379.
Similar or related permutations: A246376, A246378, A246363, A246364, A246366, A246368, A064216, A246682.
Sequence in context: A246378 A260422 A237126 * A200639 A365255 A243968
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 29 2014
STATUS
approved