cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A066540 The first of two consecutive primes with equal digital sums.

This page as a plain text file.
%I A066540 #50 Mar 27 2025 17:05:14
%S A066540 523,1069,1259,1759,1913,2503,3803,4159,4373,4423,4463,4603,4703,4733,
%T A066540 5059,5209,6229,6529,6619,7159,7433,7459,8191,9109,9749,9949,10691,
%U A066540 10753,12619,12763,12923,13763,14033,14107,14303,14369,15859,15973,16529,16673,16903,17239
%N A066540 The first of two consecutive primes with equal digital sums.
%C A066540 The difference between the two primes of the pair is a multiple of 18. - _Antonio Roldán_, Mar 13 2012
%H A066540 Harry J. Smith, <a href="/A066540/b066540.txt">Table of n, a(n) for n = 1..1000</a>
%H A066540 G. L. Honaker, Jr. and C. Caldwell, <a href="https://t5k.org/curios/page.php?short=523">Prime Curios!</a>
%e A066540 a(1) = 523 because both it and the next prime, 541, have a digital sum of 10.
%t A066540 Prime[ Select[Range[2000], Apply[ Plus, IntegerDigits[ Prime[ # ]]] == Apply[ Plus, IntegerDigits[ Prime[ # + 1]]] & ]]
%t A066540 Prime[#]&/@(SequencePosition[Total[IntegerDigits[#]]&/@Prime[Range[2000]],{x_,x_}][[;;,1]]) (* _Harvey P. Dale_, Mar 27 2025 *)
%o A066540 (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
%o A066540 (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
%o A066540 (Python)
%o A066540 from sympy import nextprime
%o A066540 from itertools import islice
%o A066540 def agen(): # generator of terms
%o A066540     p, hp, q, hq = 2, 2, 3, 3
%o A066540     while True:
%o A066540         if hp == hq: yield p
%o A066540         p, q = q, nextprime(q)
%o A066540         hp, hq = hq, sum(map(int, str(q)))
%o A066540 print(list(islice(agen(), 42))) # _Michael S. Branicky_, Feb 19 2024
%Y A066540 Subsequence of A117838. A069567 is a subsequence.
%Y A066540 Cf. A007513, A007953, A209396, A210629.
%K A066540 base,easy,nonn
%O A066540 1,1
%A A066540 _Jason Earls_, Jan 06 2002