%I #15 Sep 01 2014 11:47:19
%S 1,3,9,2,21,6,5,18,4,42,39,12,11,10,36,8,15,84,23,78,24,22,7,20,72,16,
%T 30,168,47,46,189,156,48,44,14,40,17,144,32,60,45,336,13,94,92,378,41,
%U 312,96,88,28,80,25,34,288,64,120,90,81,672,133,26,188,184,756,82,135,624,192,176,83,56,49
%N Permutation of natural numbers: a(1) = 1, a(p_n) = A003961(1+a(n)), a(c_n) = 2*a(n), where p_n = n-th prime = A000040(n), c_n = n-th composite number = A002808(n), and A003961(n) shifts the prime factorization of n one step towards larger primes.
%C Because 2 is the only even prime, it implies that, apart from a(2)=3, odd numbers occur in odd positions only (along with many even numbers that also occur in odd positions). This in turn implies that each odd composite (A071904) resides in a separate infinite cycle in this permutation, except 9, which is in a finite cycle (2 3 9 4).
%H Antti Karttunen, <a href="/A246379/b246379.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F a(1) = 1, and for n > 1, if A010051(n) = 1 [i.e. when n is a prime], a(n) = A003961(1+a(A000720(n))), otherwise a(n) = 2*a(A065855(n)).
%F As a composition of related permutations:
%F a(n) = A246375(A246377(n)).
%F Other identities. For all n > 1 the following holds:
%F A000035(a(n)) = A010051(n). [Maps primes to odd numbers > 1, and composites to even numbers, in some order. Permutations A246377 & A246681 have the same property].
%o (PARI)
%o default(primelimit, (2^31)+(2^30));
%o A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of _Michel Marcus_
%o A246379(n) = if(1==n, 1, if(isprime(n), A003961(1+A246379(primepi(n))), 2*A246379(n-primepi(n)-1)));
%o for(n=1, 10000, write("b246379.txt", n, " ", A246379(n)));
%o (Scheme, with memoization-macro definec)
%o (definec (A246379 n) (cond ((< n 2) n) ((= 1 (A010051 n)) (A003961 (+ 1 (A246379 (A000720 n))))) (else (* 2 (A246379 (A065855 n))))))
%Y Inverse: A246380.
%Y Similar or related permutations: A246375, A246377, A246363, A246364, A246365, A246367, A246681.
%Y Cf. A000720, A003961, A010051, A065855, A071904.
%K nonn
%O 1,2
%A _Antti Karttunen_, Aug 29 2014
|