login
Indices k such that (1/3)*(prime(k)+prime(k+1)+prime(k+2)) is a prime.
81

%I #59 Oct 16 2024 09:23:45

%S 2,15,36,39,46,54,55,73,102,107,110,118,129,160,164,184,187,194,199,

%T 218,239,271,272,291,339,358,387,419,426,464,465,508,520,553,599,605,

%U 621,629,633,667,682,683,702,709,710,733,761,791,813,821,822,829,830

%N Indices k such that (1/3)*(prime(k)+prime(k+1)+prime(k+2)) is a prime.

%C n such that d(n) = d(n+1), where d(n) = prime(n+1) - prime(n) = A001223(n).

%C 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.

%C From _Lei Zhou_, Dec 06 2005: (Start)

%C When (1/3)*(prime(k) + prime(k+1) + prime(k+2)) is prime, then it is equal to prime(k+1).

%C Also, indices k such that (prime(k)+prime(k+2))/2 = prime(k+1).

%C The Mathematica program is based on the alternative definition. (End)

%C 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

%H Harry J. Smith, <a href="/A064113/b064113.txt">Table of n, a(n) for n=1..1000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Inflection_point">Inflection point</a>

%F 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

%F A262138(2*a(n)) = 0. - _Reinhard Zumkeller_, Sep 12 2015

%F a(n) = A000720(A006562(n)) - 1, where A000720 = (prime)pi, A006562 = balanced primes. - _M. F. Hasler_, Oct 15 2024

%e a(2) = 15 because (p(15)+p(16)+p(17)) = 1/3(47 + 53 + 59) = 53 (prime average of three successive primes).

%e 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

%t 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 *)

%t Join@@Position[Differences[Array[Prime,100],2],0] (* _Gus Wiseman_, Mar 24 2020 *)

%o (PARI) d(n) = prime(n+1)-prime(n); j=[]; for(n=1,1500, if(d(n)==d(n+1), j=concat(j,n))); j

%o (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

%o (PARI) [n | n<-[1..888], !A036263(n)] \\ _M. F. Hasler_, Oct 15 2024

%o (PARI) \\ More efficient for larges range of n:

%o 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

%o (Haskell)

%o import Data.List (elemIndices)

%o a064113 n = a064113_list !! (n-1)

%o a064113_list = map (+ 1) $ elemIndices 0 a036263_list

%o -- _Reinhard Zumkeller_, Jan 20 2012

%o (Python)

%o from itertools import count, islice

%o from sympy import prime, nextprime

%o def A064113_gen(startvalue=1): # generator of terms >= startvalue

%o c = max(startvalue,1)

%o p = prime(c)

%o q = nextprime(p)

%o r = nextprime(q)

%o for k in count(c):

%o if p+r==(q<<1):

%o yield k

%o p, q, r = q, r, nextprime(r)

%o A064113_list = list(islice(A064113_gen(),20)) # _Chai Wah Wu_, Feb 27 2024

%Y Indices of zeros in A036263 (second differences of primes).

%Y Indices (A000720 = primepi) of balanced primes A006562, minus 1.

%Y Cf. A001223, A024675, A075540, A075541.

%Y Cf. A262138.

%Y Complement of A333214.

%Y First differences are A333216.

%Y The version for strict ascents is A258025.

%Y The version for strict descents is A258026.

%Y The version for weak ascents is A333230.

%Y The version for weak descents is A333231.

%Y A triangle for anti-runs of compositions is A106356.

%Y Lengths of maximal runs of prime gaps are A333254.

%Y Anti-runs of compositions in standard order are A333381.

%Y Cf. A000040, A084758, A124762, A124767, A238279.

%K easy,nonn

%O 1,1

%A _Jason Earls_, Sep 08 2001