|
|
A246682
|
|
Permutation of natural numbers: a(1) = 0, a(2) = 1, and for n > 1, a(2n) = nthcomposite(a(n)), a(2n-1) = nthprime(a(A064989(2n-1))), where nthprime = A000040, nthcomposite = A002808, and A064989(n) shifts the prime factorization of n one step towards smaller primes.
|
|
6
|
|
|
0, 1, 2, 4, 3, 6, 5, 9, 7, 8, 11, 12, 31, 10, 13, 16, 127, 14, 709, 15, 19, 20, 5381, 21, 17, 46, 23, 18, 52711, 22, 648391, 26, 29, 166, 41, 24, 9737333, 858, 71, 25, 174440041, 30, 3657500101, 32, 37, 6186
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Note the indexing: the domain starts from 1, while the range includes also zero.
Has an infinite number of infinite cycles. See comments at A246681.
|
|
LINKS
|
|
|
FORMULA
|
a(1) = 0, a(2) = 1, and for n > 1, a(2n) = nthcomposite(a(n)), a(2n-1) = nthprime(a(A064989(2n-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:
Other identities.
For all n >= 1 the following holds:
a(A000040(n)) = A007097(n-1). [Maps primes to the iterates of primes].
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 & A246380 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)};
for(n=1, 46, write("b246682.txt", n, " ", A246682(n)));
(Scheme, two variants)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|