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.

A069754 Counts transitions between prime and nonprime to reach the number n.

This page as a plain text file.
%I A069754 #38 Jan 17 2024 05:08:12
%S A069754 0,1,1,2,3,4,5,6,6,6,7,8,9,10,10,10,11,12,13,14,14,14,15,16,16,16,16,
%T A069754 16,17,18,19,20,20,20,20,20,21,22,22,22,23,24,25,26,26,26,27,28,28,28,
%U A069754 28,28,29,30,30,30,30,30,31,32,33,34,34,34,34,34,35,36,36,36,37,38,39
%N A069754 Counts transitions between prime and nonprime to reach the number n.
%C A069754 The following sequences all appear to have the same parity (with an extra zero term at the start of A010051): A010051, A061007, A035026, A069754, A071574. - _Jeremy Gardiner_, Aug 09 2002
%H A069754 T. D. Noe, <a href="/A069754/b069754.txt">Table of n, a(n) for n=1..1000</a>
%F A069754 When n is prime, a(n) = 2*pi(n) - 3. When n is composite, a(n) = 2*pi(n) - 2. pi(n) is the prime counting function A000720.
%F A069754 For n > 2: a(n) = 2*A000720(n) - 2 - A010051(n). - _Reinhard Zumkeller_, Dec 04 2012
%e A069754 a(6) = 4 because there are 4 transitions: 1 to 2, 3 to 4, 4 to 5 and 5 to 6.
%t A069754 For[lst={0}; trans=0; n=2, n<100, n++, If[PrimeQ[n]!=PrimeQ[n-1], trans++ ]; AppendTo[lst, trans]]; lst
%t A069754 (* Second program: *)
%t A069754 pts[n_]:=Module[{c=2PrimePi[n]},If[PrimeQ[n],c-3,c-2]]; Join[{0,1},Array[ pts,80,3]] (* _Harvey P. Dale_, Nov 12 2011 *)
%t A069754 Accumulate[If[Sort[PrimeQ[#]]=={False,True},1,0]&/@Partition[ Range[ 0,80],2,1]] (* _Harvey P. Dale_, May 06 2013 *)
%o A069754 (Haskell)
%o A069754 a069754 1 = 0
%o A069754 a069754 2 = 1
%o A069754 a069754 n = 2 * a000720 n - 2 - (toInteger $ a010051 $ toInteger n)
%o A069754 -- _Reinhard Zumkeller_, Dec 04 2012
%Y A069754 Cf. A000720 (pi).
%Y A069754 Cf. A211005 (run lengths).
%Y A069754 Same parity: A010051, A061007, A035026, A071574.
%K A069754 easy,nice,nonn
%O A069754 1,4
%A A069754 _T. D. Noe_, May 02 2002