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.

A073445 Second differences of A002808, the sequence of composites.

This page as a plain text file.
%I A073445 #33 Jun 03 2025 02:27:21
%S A073445 0,-1,0,1,0,-1,0,1,0,-1,0,1,-1,0,0,0,1,0,-1,0,0,0,1,-1,0,1,0,-1,0,1,
%T A073445 -1,0,0,0,1,-1,0,0,0,1,0,-1,0,0,0,1,-1,0,1,0,-1,0,0,0,1,-1,0,1,-1,0,0,
%U A073445 0,1,-1,0,0,0,0,0,1,-1,0,1,0,-1,0,1,0,-1,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,1,-1,0,0,0,1,0,-1,0,0,0,0,0,0,0,1,0,-1,0
%N A073445 Second differences of A002808, the sequence of composites.
%H A073445 Reinhard Zumkeller, <a href="/A073445/b073445.txt">Table of n, a(n) for n = 1..10000</a>
%F A073445 a(n) = c(n+2)-2*c(n+1)+c(n), where c(n) = A002808(n).
%F A073445 a(n) = A073783(n+1) - A073783(n). - _Reinhard Zumkeller_, Jan 10 2013
%e A073445 From _Gus Wiseman_, Oct 10 2024: (Start)
%e A073445 The composite numbers (A002808) are:
%e A073445   4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, ...
%e A073445 with first differences (A073783):
%e A073445   2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, ...
%e A073445 with first differences (A073445):
%e A073445   0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 1, -1, ...
%e A073445 (End)
%t A073445 c[x_] := FixedPoint[x+PrimePi[ # ]+1&, x]; Table[c[w+2]-2*c[w+1]+c[w], {w, 200}]
%t A073445 (* second program *)
%t A073445 Differences[Select[Range[100],CompositeQ],2] (* _Gus Wiseman_, Oct 08 2024 *)
%o A073445 (Haskell)
%o A073445 a073445 n = a073445_list !! (n-1)
%o A073445 a073445_list = zipWith (-) (tail a073783_list) a073783_list
%o A073445 -- _Reinhard Zumkeller_, Jan 10 2013
%o A073445 (Python)
%o A073445 from sympy import primepi
%o A073445 def A073445(n):
%o A073445     def iterfun(f,n=0):
%o A073445         m, k = n, f(n)
%o A073445         while m != k: m, k = k, f(k)
%o A073445         return m
%o A073445     return (a:=iterfun(f:=lambda x:n+primepi(x)+1,n))-((b:=iterfun(lambda x:f(x)+1,a))<<1)+iterfun(lambda x:f(x)+2,b) # _Chai Wah Wu_, Oct 03 2024
%Y A073445 Also first differences of A054546.
%Y A073445 For first differences we had A073783 (ones A375929), run-lengths A376680.
%Y A073445 Positions of zeros are A376602.
%Y A073445 Positions of nonzeros are A376603.
%Y A073445 Positions of ones are A376651, negative-ones A376652.
%Y A073445 A002808 lists the composite numbers.
%Y A073445 A064113 lists positions of adjacent equal prime gaps.
%Y A073445 A333254 gives run-lengths of differences between consecutive primes.
%Y A073445 Other second differences: A036263 (prime), A376590 (squarefree), A376596 (prime-power), A376604 (Kolakoski).
%Y A073445 Cf. A076259, A174965, A251092, A376562, A376593, A376599.
%K A073445 sign,easy
%O A073445 1,1
%A A073445 _Labos Elemer_, Aug 01 2002