login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A178659
Numbers n such that n^2 +- (n-1)^2 are primes.
3
2, 3, 6, 10, 15, 30, 31, 36, 40, 51, 66, 70, 91, 100, 136, 175, 190, 205, 225, 231, 261, 285, 286, 316, 321, 331, 370, 376, 411, 441, 465, 496, 516, 520, 526, 535, 546, 565, 576, 586, 591, 681, 720, 730, 745, 750, 766, 855, 871, 906, 916, 951, 975, 1081, 1120
OFFSET
1,1
LINKS
FORMULA
a(n) = 1 + A068501(n). - Zak Seidov, Feb 10 2015
EXAMPLE
2 is in the sequence because 2^2 + 1^2 = 5 and 2^2 - 1^2 = 3 are both prime.
3 is in the sequence because 3^2 + 2^2 = 13 and 3^2 - 2^2 = 5 are both prime.
MATHEMATICA
lst={}; Do[If[PrimeQ[n^2-(n-1)^2]&&PrimeQ[n^2+(n-1)^2], AppendTo[lst, n]], {n, 7!}]; lst
Select[Range[8!], PrimeQ[#^2 -(#-1)^2] && PrimeQ[#^2 +(#-1)^2] &] (* G. C. Greubel, Jan 28 2019 *)
PROG
(PARI) A178659()={my(maxx=1000); n=2; ptr=0;
while(n<=maxx, q1=n^2-(n-1)^2; q2=n^2+(n-1)^2;
if(isprime(q1)&&isprime(q2), ptr++; write("b178659.txt", ptr, " ", n)); n++); } \\ Bill McEachen, Jun 13 2014
CROSSREFS
Cf. A068501.
Sequence in context: A280421 A369425 A018141 * A268064 A077011 A246868
KEYWORD
nonn
AUTHOR
STATUS
approved