cp's OEIS Frontend

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.

A246378 Permutation of natural numbers: a(1) = 1, a(2n) = nthcomposite(a(n)), a(2n+1) = nthprime(a(n)), where nthcomposite = A002808, nthprime = A000040.

This page as a plain text file.
%I A246378 #16 Sep 23 2014 22:57:02
%S A246378 1,4,2,9,7,6,3,16,23,14,17,12,13,8,5,26,53,35,83,24,43,27,59,21,37,22,
%T A246378 41,15,19,10,11,39,101,75,241,51,149,114,431,36,89,62,191,40,103,82,
%U A246378 277,33,73,54,157,34,79,58,179,25,47,30,67,18,29,20,31,56,167,134,547,102,379,304,1523,72,233
%N A246378 Permutation of natural numbers: a(1) = 1, a(2n) = nthcomposite(a(n)), a(2n+1) = nthprime(a(n)), where nthcomposite = A002808, nthprime = A000040.
%C A246378 Contains an infinite number of infinite cycles. See comments at A246377.
%H A246378 Antti Karttunen, <a href="/A246378/b246378.txt">Table of n, a(n) for n = 1..4096</a>
%H A246378 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A246378 a(1) = 1, a(2n) = nthcomposite(a(n)), a(2n+1) = nthprime(a(n)), where nthcomposite = A002808, nthprime = A000040.
%F A246378 As a composition of related permutations:
%F A246378 a(n) = A227413(A054429(n)).
%F A246378 a(n) = A236854(A227413(n)).
%F A246378 a(n) = A246380(A246375(n)).
%F A246378 a(n) = A246682(A163511(n)). [For n >= 1].
%F A246378 Other identities. For all n > 1 the following holds:
%F A246378 A010051(a(n)) = A000035(n). [Maps odd numbers larger than one to primes, and even numbers to composites, in some order. Permutations A246380 & A246682 have the same property].
%o A246378 (PARI)
%o A246378 A002808(n) = { my(k=-1); while( -n + n += -k + k=primepi(n), ); n }; \\ This function from _M. F. Hasler_
%o A246378 A246378(n) = if(1==n, 1, if(!(n%2), A002808(A246378(n/2)), prime(A246378((n-1)/2))));
%o A246378 for(n=1, 4096, write("b246378.txt", n, " ", A246378(n)));
%o A246378 (Scheme, with memoizing definec-macro)
%o A246378 (definec (A246378 n) (cond ((< n 2) n) ((even? n) (A002808 (A246378 (/ n 2)))) (else (A000040 (A246378 (/ (- n 1) 2))))))
%Y A246378 Inverse: A246377.
%Y A246378 Similar or related permutations: A237126, A054429, A227413, A236854, A246375, A246380, A246682, A163511.
%Y A246378 Cf. A000035, A000040, A002808, A010051, A071904.
%K A246378 nonn,look
%O A246378 1,2
%A A246378 _Antti Karttunen_, Aug 27 2014