login
Numbers n such that n^2+sum-of-digits(n^2) is prime.
1

%I #12 Sep 27 2013 10:57:25

%S 1,4,10,16,31,32,40,41,43,62,71,76,94,95,97,98,121,142,158,163,164,

%T 166,179,188,208,211,214,227,229,259,260,265,284,301,313,317,320,328,

%U 331,340,352,355,356,365,380,382,386,392,397,401,418,424,425,431,436,439

%N Numbers n such that n^2+sum-of-digits(n^2) is prime.

%C This is the sequence of indices of prime numbers in A171613.

%C The Ulam spiral for this sequence is a near-perfect line y=-x (see links).

%H Christian N. K. Anderson, <a href="/A224966/b224966.txt">Table of n, a(n) for n = 1..10000</a>

%H Christian N. K. Anderson, The <a href="/A224966/a224966.jpg">Ulam Spiral</a> for the prime numbers derived from this sequence, i.e. a(n)^2+sum of digits(a(n)^2)

%e a(12)=76 because 76^2=5776, and 5776+(5+7+7+6)=5801, which is prime.

%o (R) library(gmp); digsum<-function(x) sum(as.numeric(unlist(strsplit(as.character(x),split=""))))

%o ans=as.bigz(rep(0,100)); n=1; i=as.bigz(1)

%o while(n<=100) {

%o if(isprime((w=i^2+digsum(i^2)))) ans[(n=n+1)-1]=i

%o i=i+1

%o }; ans

%Y Cf. A048521.

%Y Cf. numbers of the form n^2+sum-of-digits(n^2) A171613, and subsets A171614, A171615.

%Y Cf. A062028.

%K nonn,base

%O 1,2

%A _Kevin L. Schwartz_ and _Christian N. K. Anderson_, Apr 21 2013