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.
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
Offset: 1
Keywords
Crossrefs
Programs
-
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)}; A246682(n) = if(n < 3, n-1, if(!(n%2), A002808(A246682(n/2)), prime(A246682(A064989(n))))); for(n=1, 46, write("b246682.txt", n, " ", A246682(n))); (Scheme, two variants) (definec (A246682 n) (cond ((<= n 2) (- n 1)) ((even? n) (A002808 (A246682 (/ n 2)))) (else (A000040 (A246682 (A064989 n)))))) (define (A246682 n) (A246378 (A243071 n)))
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:
For all n > 1 the following holds:
Comments