login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #13 Sep 01 2014 11:47:37

%S 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,

%T 62,83,51,79,27,233,39,191,54,149,15,103,134,11,36,47,10,151,34,41,30,

%U 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

%N 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.

%C Has an infinite number of infinite cycles. See comments in A246379.

%H Antti Karttunen, <a href="/A246380/b246380.txt">Table of n, a(n) for n = 1..3098</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F 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.

%F As a composition of related permutations:

%F a(n) = A246378(A246376(n)).

%F Other identities. For all n > 1 the following holds:

%F 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].

%o (PARI)

%o default(primelimit,(2^31)+(2^30));

%o A002808(n) = { my(k=-1); while( -n + n += -k + k=primepi(n), ); n }; \\ This function from _M. F. Hasler_

%o 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)};

%o A246380(n) = if(1==n, 1, if(!(n%2), A002808(A246380(n/2)), prime(A246380(A064989(n)-1))));

%o for(n=1, 3098, write("b246380.txt", n, " ", A246380(n)));

%o (Scheme, with memoization-macro definec)

%o (definec (A246380 n) (cond ((< n 2) n) ((even? n) (A002808 (A246380 (/ n 2)))) (else (A000040 (A246380 (- (A064989 n) 1))))))

%Y Inverse: A246379.

%Y Similar or related permutations: A246376, A246378, A246363, A246364, A246366, A246368, A064216, A246682.

%Y Cf. A000035, A000040, A002808, A010051, A064989.

%K nonn

%O 1,2

%A _Antti Karttunen_, Aug 29 2014