cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A235986 Numbers n such that two of the primes between n^2 and (n+1)^2 add up to n^2+(n+1)^2 - 1.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60
Offset: 1

Views

Author

César Aguilera, Jan 17 2014

Keywords

Comments

Up to 10^6, the numbers missing from the sequence are 1, 17, 19, 46, 58, 64, 67, 85, and 367. - Giovanni Resta, Feb 26 2014

Examples

			For n=2 n+1=3; primes between 4 and 9 are (5,7);4+9-1=12 and 5+7=12.
For n=3 n+1=4; primes between 9 and 16 are (11,13); 9+16-1=24 and 11+13=24.
For n=18 n+1=19; primes between 324 and 361 are (331,337,347,349,353,359);324+361-1=684 and 331+353=684.
		

Crossrefs

Programs

  • Mathematica
    ok[n_] := n>1 && Catch@Block[{p = NextPrime[n^2]}, While[p < (n+1)^2, If[PrimeQ[ 2*n*(n+1) - p], Throw@True, p = NextPrime@p]]; False]; Select[Range@100, ok] (* Giovanni Resta, Feb 26 2014 *)
  • PARI
    buildp(n) = {my(vp = []); forprime(p = n^2, (n+1)^2, vp = concat(vp, p);); vp;}
    issum(vp, n) = {my(summ = n^2+(n+1)^2 - 1); for (i = 1, #vp, for (j = i+1, #vp, if (vp[i]+vp[j] == summ, return (1)););); return (0);}
    isok(n) = my(vp = buildp(n)); issum(vp, n); \\ Michel Marcus, Jan 18 2014