login
Primes p such that p minus its digit sum is a square.
1

%I #28 Apr 16 2019 00:31:51

%S 2,3,5,7,11,13,17,19,41,43,47,97,151,157,233,239,331,337,457,593,599,

%T 743,911,919,1301,1303,1307,1531,1783,1787,1789,2039,2311,2617,2939,

%U 3613,3617,4373,4783,4787,4789,5641,5647,6581,7079,7591,8111,8117,8677,9239,9829,11681,11689,13001,13003,13007

%N Primes p such that p minus its digit sum is a square.

%H Robert Israel, <a href="/A321150/b321150.txt">Table of n, a(n) for n = 1..3000</a>

%e 11 is prime and 11 - (1+1) = 9 = 3^2 is square, so 11 is a term of the sequence.

%e 457 is prime and 457 - (4+5+7) = 441 = 21^2 is square, so 457 is a term of the sequence.

%e 2939 is prime and 2939 - (2+9+3+9) = 2916 = 54^2 is square, so 2939 is a term of the sequence.

%e 101 is prime and 101 - (1+0+1) = 99 is not square, so 101 is not a term of the sequence.

%p select(t -> isprime(t) and issqr(t - convert(convert(t,base,10),`+`)),

%p [2,seq(i,i=3..20000,2)]); # _Robert Israel_, Apr 15 2019

%t Select[Prime@ Range@ 2000, IntegerQ@ Sqrt[# - Total@ IntegerDigits@ #] &] (* _Michael De Vlieger_, Nov 05 2018 *)

%o (PARI) isok(p) = isprime(p) && issquare(p-sumdigits(p)); \\ _Michel Marcus_, Oct 30 2018

%Y Cf. A000290, A007605, A007953, A245064, A068395.

%Y Intersection of A000040 and A066566.

%K nonn,base

%O 1,1

%A _Marius A. Burtea_, Oct 28 2018

%E a(26) corrected by _Robert Israel_, Apr 15 2019