This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A246379 #15 Sep 01 2014 11:47:19 %S A246379 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 A246379 30,168,47,46,189,156,48,44,14,40,17,144,32,60,45,336,13,94,92,378,41, %U A246379 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 A246379 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 A246379 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 A246379 Antti Karttunen, <a href="/A246379/b246379.txt">Table of n, a(n) for n = 1..10000</a> %H A246379 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A246379 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 A246379 As a composition of related permutations: %F A246379 a(n) = A246375(A246377(n)). %F A246379 Other identities. For all n > 1 the following holds: %F A246379 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 A246379 (PARI) %o A246379 default(primelimit, (2^31)+(2^30)); %o A246379 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 A246379(n) = if(1==n, 1, if(isprime(n), A003961(1+A246379(primepi(n))), 2*A246379(n-primepi(n)-1))); %o A246379 for(n=1, 10000, write("b246379.txt", n, " ", A246379(n))); %o A246379 (Scheme, with memoization-macro definec) %o A246379 (definec (A246379 n) (cond ((< n 2) n) ((= 1 (A010051 n)) (A003961 (+ 1 (A246379 (A000720 n))))) (else (* 2 (A246379 (A065855 n)))))) %Y A246379 Inverse: A246380. %Y A246379 Similar or related permutations: A246375, A246377, A246363, A246364, A246365, A246367, A246681. %Y A246379 Cf. A000720, A003961, A010051, A065855, A071904. %K A246379 nonn %O A246379 1,2 %A A246379 _Antti Karttunen_, Aug 29 2014