%I #13 Apr 10 2019 13:50:48
%S 2,5,17,23,29,53,59,83,113,149,167,179,239,281,383,389,431,443,491,
%T 509,569,659,1019,1031,1061,1103,1259,1289,1409,1427,1439,1901,2003,
%U 2081,2111,2129,2207,2237,2309,2357,2441,2543,2657,2687,2801,3137,3203,3221,3359,3407
%N SanD primes: primes p such that p+d is also prime and digit_sum(p(p+d)) = d, for some d.
%C Frankel named "S(um)anD(ifference) number" any n such that the sum of digits of n(n+d) equals d, for some d. SanD primes are SanD numbers p such that p and p+d are prime. For given d, we will refer to SanD-d numbers or primes.
%C The only prime solution with odd d is p = 2, d = 5.
%C All other SanD primes must have d == 14 (mod 18).
%C This is the list of all SanD primes, i.e., the union of the SanD-5 prime 2, the SanD-14 primes A307471, SanD-32 primes A307472, SanD-50 primes A307473, etc.
%C Sequence A307480 lists the smallest SanD-d prime for all possible d = 14 + 18*k, k = -1/2, 0, 1, 2, 3, ...
%H Robert Israel, <a href="/A307479/b307479.txt">Table of n, a(n) for n = 1..10000</a>
%H Freeman J. Dyson, Norman E. Frankel, Anthony J. Guttmann: <a href="https://arxiv.org/abs/1904.03573">SanD primes and numbers</a>, arxiv:1904.03573 [math.CA], April 7, 2019
%e a(1) = 2 = A307480(-1) is the smallest (and only) SanD-5 prime: 2 and 2 + 5 = 7 both are prime, and the digit sum A007953(2*7) = 1 + 4 = 5.
%e All other SanD primes must have a gap and sum d = 14 + 18*k, k = 0, 1, 2, ...
%e a(2) = 5 = A307471(1) = A307480(0) is the smallest SanD-14 prime: 5 and 5 + 14 = 19 both are prime and the digit sum A007953(5*19) = 9 + 5 = 14.
%e a(10) = 149 = A307472(1) = A307480(1) is the smallest SanD-32 prime: 149 and 149 + 32 = 181 both are prime, and the digit sum A007953(149*181) = 2+6+9+6+9 = 32.
%e a(42) = 2543 = A307473(1) = A307480(2) is the smallest SanD-50 prime: 2543 and 2543 + 50 = 2593 both are prime, and the digit sum A007953(2543*2593) = 6+5+9+3+9+9+9 = 50.
%e a(186) = 19961 = A307474(1) = A307480(3) is the smallest SanD-68 prime: 19961 and 19961 + 68 = 20029 both are prime, and the digit sum A007953(19961*20029) = 3+9+9+7+9+8+8+6+9 = 68.
%p filter:= proc(p) local d;
%p if not isprime(p) then return false fi;
%p for d from 14 by 18 while is(d <= 9*log[10](p*(p+d))+1) do
%p if isprime(p+d) and convert(convert(p*(p+d),base,10),`+`)=d then return true fi
%p od:
%p false
%p end proc:
%p filter(2):= true:
%p select(filter, [2,seq(i,i=5..10000,6)]); # _Robert Israel_, Apr 10 2019
%o (PARI) A307479_upto(LIM=2e4, A=List(2))={ forstep(d=14,oo,18, my(L=#A); forprime(p=3,LIM, isprime(p+d) && sumdigits(p*(p+d))==d && listput(A,p)); L==#A && break); Set(A)}
%Y Cf. A307471 - A307478 (d = 14+18k, k=0..7), A307480 (smallest prime for given d).
%Y Cf. A000040 (primes), A007953 (sum of digits).
%K nonn,base
%O 1,1
%A _M. F. Hasler_, Apr 09 2019