OFFSET
1,1
COMMENTS
The difference between the two primes of the pair is a multiple of 18. - Antonio Roldán, Mar 13 2012
LINKS
Harry J. Smith, Table of n, a(n) for n = 1..1000
G. L. Honaker, Jr. and C. Caldwell, Prime Curios!
EXAMPLE
a(1) = 523 because both it and the next prime, 541, have a digital sum of 10.
MATHEMATICA
Prime[ Select[Range[2000], Apply[ Plus, IntegerDigits[ Prime[ # ]]] == Apply[ Plus, IntegerDigits[ Prime[ # + 1]]] & ]]
PROG
(PARI) upto(limit)={my(d=2, L=List()); forprime(p=3, nextprime(limit+1), my(s=sumdigits(p)); if(s==d, listput(L, precprime(p-1))); d=s); Vec(L) } \\ Harry J. Smith, Feb 22 2010
(PARI) is_A066540(p)={my(n=nextprime(p+1)); (n-p)%18==0 & isprime(p) & A007953(p)==A007953(n)} \\ M. F. Hasler, Oct 13 2012
(Python)
from sympy import nextprime
from itertools import islice
def agen(): # generator of terms
p, hp, q, hq = 2, 2, 3, 3
while True:
if hp == hq: yield p
p, q = q, nextprime(q)
hp, hq = hq, sum(map(int, str(q)))
print(list(islice(agen(), 42))) # Michael S. Branicky, Feb 19 2024
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Jason Earls, Jan 06 2002
STATUS
approved