A051795 Doubly balanced primes: primes which are averages of both their immediate and their second neighbors.
18731, 25621, 28069, 30059, 31051, 44741, 76913, 97441, 103669, 106681, 118831, 128449, 135089, 182549, 202999, 240491, 245771, 249199, 267569, 295387, 347329, 372751, 381401, 435751, 451337, 455419, 471521, 478099, 498301, 516877, 526441, 575231, 577873
Offset: 1
Examples
25621 belongs to the sequence because 25621 = (25609 + 25633)/2 = (25603 + 25609 + 25633 + 25639)/4.
Links
- Jud McCranie and Sebastian Petzelberger, Table of n, a(n) for n = 1..10000 (first 1000 terms from Jud McCranie)
Programs
-
Mathematica
Transpose[Select[Partition[Prime[Range[50000]],5,1],(#[[1]]+#[[5]])/2 == (#[[2]]+#[[4]])/2 == #[[3]]&]][[3]] (* Harvey P. Dale, Sep 13 2013 *)
-
Python
from sympy import nextprime; p, q, r, s, t = 2, 3, 5, 7, 11 while t < 580000: if p + t == q + s == 2*r: print(r, end = ', ') p, q, r, s, t = q, r, s, t, nextprime(t) # Ya-Ping Lu, May 11 2024
Comments