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

MATHEMATICA

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 *)