OFFSET
1,1
COMMENTS
n such that d(n) = d(n+1), where d(n) = prime(n+1) - prime(n) = A001223(n).
Of interest because when I generalize it to d(n) = d(n+2), d(n) = d(n+3), etc. I am unable to find any positive number k such that d(n) = d(n+k) has no solution.
From Lei Zhou, Dec 06 2005: (Start)
When (1/3)*(prime(k) + prime(k+1) + prime(k+2)) is prime, then it is equal to prime(k+1).
Also, indices k such that (prime(k)+prime(k+2))/2 = prime(k+1).
The Mathematica program is based on the alternative definition. (End)
Inflection and undulation points of the primes, i.e., positions of zeros in A036263, the second differences of the primes. - Gus Wiseman, Mar 24 2020
LINKS
Harry J. Smith, Table of n, a(n) for n=1..1000
Wikipedia, Inflection point
FORMULA
A036263(a(n)) = 0; A122535(n) = A000040(a(n)); A006562(n) = A000040(a(n) + 1); A181424(n) = A000040(a(n) + 2). - Reinhard Zumkeller, Jan 20 2012
A262138(2*a(n)) = 0. - Reinhard Zumkeller, Sep 12 2015
a(n) = A000720(A006562(n)) - 1, where A000720 = (prime)pi, A006562 = balanced primes. - M. F. Hasler, Oct 15 2024
EXAMPLE
a(2) = 15 because (p(15)+p(16)+p(17)) = 1/3(47 + 53 + 59) = 53 (prime average of three successive primes).
Splitting the prime gaps into anti-runs gives: (1,2), (2,4,2,4,2,4,6,2,6,4,2,4,6), (6,2,6,4,2,6,4,6,8,4,2,4,2,4,14,4,6,2,10,2,6), (6,4,6), ... Then a(n) is the n-th partial sum of the lengths of these anti-runs. - Gus Wiseman, Mar 24 2020
MATHEMATICA
ct = 0; Do[If[(Prime[k] + Prime[k + 2] - 2*Prime[k + 1]) == 0, ct++; n[ct] = k], {k, 1, 2000}]; Table[n[k], {k, 1, ct}] (* Lei Zhou, Dec 06 2005 *)
Join@@Position[Differences[Array[Prime, 100], 2], 0] (* Gus Wiseman, Mar 24 2020 *)
PROG
(PARI) d(n) = prime(n+1)-prime(n); j=[]; for(n=1, 1500, if(d(n)==d(n+1), j=concat(j, n))); j
(PARI) { n=0; for (m=1, 10^9, if (d(m)==d(m+1), write("b064113.txt", n++, " ", m); if (n==1000, break)) ) } \\ Using d(n) above. - Harry J. Smith, Sep 07 2009
(PARI) [n | n<-[1..888], !A036263(n)] \\ M. F. Hasler, Oct 15 2024
(PARI) \\ More efficient for larges range of n:
A064113_upto(N, n=1, L=List(), q=prime(n+1), d=q-prime(n))={forprime(p=1+q, , if(d==d=p-q, listput(L, n); #L<N||break); n++; q=p); L} \\ M. F. Hasler, Oct 15 2024
(Haskell)
import Data.List (elemIndices)
a064113 n = a064113_list !! (n-1)
a064113_list = map (+ 1) $ elemIndices 0 a036263_list
-- Reinhard Zumkeller, Jan 20 2012
(Python)
from itertools import count, islice
from sympy import prime, nextprime
def A064113_gen(startvalue=1): # generator of terms >= startvalue
c = max(startvalue, 1)
p = prime(c)
q = nextprime(p)
r = nextprime(q)
for k in count(c):
if p+r==(q<<1):
yield k
p, q, r = q, r, nextprime(r)
CROSSREFS
Indices of zeros in A036263 (second differences of primes).
Cf. A262138.
Complement of A333214.
First differences are A333216.
The version for strict ascents is A258025.
The version for strict descents is A258026.
The version for weak ascents is A333230.
The version for weak descents is A333231.
A triangle for anti-runs of compositions is A106356.
Lengths of maximal runs of prime gaps are A333254.
Anti-runs of compositions in standard order are A333381.
KEYWORD
easy,nonn
AUTHOR
Jason Earls, Sep 08 2001
STATUS
approved