login
Smallest square where a(n)+n is prime.
4

%I #7 May 07 2016 09:01:30

%S 1,0,0,1,0,1,0,9,4,1,0,1,0,9,4,1,0,1,0,9,16,1,0,49,4,81,4,1,0,1,0,9,4,

%T 9,36,1,0,9,4,1,0,1,0,9,16,1,0,25,4,9,16,1,0,25,4,81,4,1,0,1,0,9,4,9,

%U 36,1,0,81,4,1,0,1,0,9,4,25,36,1,0,9,16,1,0,25,4,81,16,1,0,49,16,9,4,9

%N Smallest square where a(n)+n is prime.

%H Harvey P. Dale, <a href="/A056897/b056897.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) =A056896(n)-n =A056898(n)^2

%e a(8)=9 since 9 is a square and 9+8=7 which is a prime

%t With[{sqs=Range[0,20]^2},Table[SelectFirst[sqs,PrimeQ[n+#]&],{n,100}]] (* The program uses the SelectFirst function from Mathematica version 10 *) (* _Harvey P. Dale_, May 07 2016 *)

%Y Cf. A000040, A002496, A056892-A056898.

%K nonn

%O 0,8

%A _Henry Bottomley_, Jul 05 2000