[go: up one dir, main page]

login
A073445
Second differences of A002808, the sequence of composites.
30
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, -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, 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
OFFSET
1,1
LINKS
FORMULA
a(n) = c(n+2)-2*c(n+1)+c(n), where c(n)=A002808(n).
a(n) = A073783(n+1) - A073783(n). - Reinhard Zumkeller, Jan 10 2013
EXAMPLE
From Gus Wiseman, Oct 10 2024: (Start)
The composite numbers (A002808) are:
4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, ...
with first differences (A073783):
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, ...
with first differences (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, ...
(End)
MATHEMATICA
c[x_] := FixedPoint[x+PrimePi[ # ]+1&, x] Table[(c[w+2]-2*c[w+1])+c[w]), {w, 1, 1000}]
(* second program *)
Differences[Select[Range[100], CompositeQ], 2] (* Gus Wiseman, Oct 08 2024 *)
PROG
(Haskell)
a073445 n = a073445_list !! (n-1)
a073445_list = zipWith (-) (tail a073783_list) a073783_list
-- Reinhard Zumkeller, Jan 10 2013
(Python)
from sympy import primepi
def A073445(n):
def iterfun(f, n=0):
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m
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
CROSSREFS
Also first differences of A054546.
For first differences we had A073783 (ones A375929), run-lengths A376680.
Positions of zeros are A376602.
Positions of nonzeros are A376603.
Positions of ones are A376651, negative-ones A376652.
A002808 lists the composite numbers.
A064113 lists positions of adjacent equal prime gaps.
A333254 gives run-lengths of differences between consecutive primes.
Other second differences: A036263 (prime), A376590 (squarefree), A376596 (prime-power), A376604 (Kolakoski).
Sequence in context: A134452 A327515 A327532 * A285589 A179081 A113217
KEYWORD
sign,easy
AUTHOR
Labos Elemer, Aug 01 2002
STATUS
approved