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.

A237739 a(0) = 1, a(2n) = nthcomposite(a(n)-1), a(2n+1) = nthprime(a(n)), where nthcomposite = A002808, nthprime = A000040.

This page as a plain text file.
%I A237739 #15 May 06 2025 21:52:45
%S A237739 1,2,4,3,8,7,6,5,14,19,12,17,10,13,9,11,22,43,28,67,20,37,26,59,16,29,
%T A237739 21,41,15,23,18,31,33,79,60,191,40,107,91,331,30,71,52,157,38,101,81,
%U A237739 277,25,53,42,109,32,73,57,179,24,47,34,83,27,61,45,127,48
%N A237739 a(0) = 1, a(2n) = nthcomposite(a(n)-1), a(2n+1) = nthprime(a(n)), where nthcomposite = A002808, nthprime = A000040.
%C A237739 A071574(a(n)) = n; a(A071574(n)) = n for n > 0.
%H A237739 Reinhard Zumkeller (terms 0-300) & Antti Karttunen, <a href="/A237739/b237739.txt">Table of n, a(n) for n = 0..4095</a>
%H A237739 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A237739 a(0) = 1, a(2n) = nthcomposite(a(n)-1), a(2n+1) = nthprime(a(n)), where nthcomposite = A002808, nthprime = A000040. - _Antti Karttunen_, Apr 04 2015
%o A237739 (Haskell)
%o A237739 import Data.List (elemIndex); import Data.Maybe (fromJust)
%o A237739 a237739 = fromIntegral . (+ 1) . fromJust . (`elemIndex` a071574_list)
%o A237739 (PARI)
%o A237739 default(primelimit,(2^31)+(2^30));
%o A237739 A002808(n) = { my(k=-1); while( -n + n += -k + k=primepi(n), ); n }; \\ This function from _M. F. Hasler_
%o A237739 A237739(n) = if(0==n, 1, if(!(n%2), A002808(A237739(n/2)-1), prime(A237739((n-1)/2))));
%o A237739 for(n=0, 4095, write("b237739.txt", n, " ", A237739(n)));
%o A237739 \\ _Antti Karttunen_, Apr 04 2015
%o A237739 (Scheme)
%o A237739 ;; With memoizing definec-macro.
%o A237739 (definec (A237739 n) (cond ((zero? n) 1) ((odd? n) (A000040 (A237739 (/ (- n 1) 2)))) (else (A002808 (+ -1 (A237739 (/ n 2)))))))
%o A237739 ;; _Antti Karttunen_, Apr 04 2015
%Y A237739 Inverse: A071574.
%Y A237739 Cf. A000040, A002808.
%Y A237739 Compare also to the permutation A246378.
%K A237739 nonn,look
%O A237739 0,2
%A A237739 _Reinhard Zumkeller_, Apr 30 2014
%E A237739 Name replaced by an explicit recurrence. - _Antti Karttunen_, Apr 04 2015