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.

Showing 1-10 of 18 results. Next

A053000 a(n) = (smallest prime > n^2) - n^2.

Original entry on oeis.org

2, 1, 1, 2, 1, 4, 1, 4, 3, 2, 1, 6, 5, 4, 1, 2, 1, 4, 7, 6, 1, 2, 3, 12, 1, 6, 1, 4, 3, 12, 7, 6, 7, 2, 7, 4, 1, 4, 3, 2, 1, 12, 13, 12, 13, 2, 13, 4, 5, 10, 3, 8, 3, 10, 1, 12, 1, 2, 7, 10, 7, 6, 3, 20, 3, 4, 1, 4, 13, 22, 3, 10, 5, 4, 1, 14, 3, 10, 5, 6, 21, 2, 9, 10, 1, 4, 15, 4, 9, 6, 1, 6, 3, 14
Offset: 0

Views

Author

N. J. A. Sloane, Feb 21 2000

Keywords

Comments

Suggested by Legendre's conjecture (still open) that there is always a prime between n^2 and (n+1)^2.
Record values are listed in A070317, their indices in A070316. - M. F. Hasler, Mar 23 2013
Conjecture: a(n) <= 1+phi(n) = 1+A000010(n), for n>0. This improves on Oppermann's conjecture, which says a(n) < n. - Jianglin Luo, Sep 22 2023

References

  • J. R. Goldman, The Queen of Mathematics, 1998, p. 82.
  • R. K. Guy, Unsolved Problems in Number Theory, Section A1.

Crossrefs

Programs

  • Magma
    [NextPrime(n^2) - n^2: n in [0..100]]; // Vincenzo Librandi, Jul 06 2015
    
  • Maple
    A053000 := n->nextprime(n^2)-n^2;
  • Mathematica
    nxt[n_]:=Module[{n2=n^2},NextPrime[n2]-n2]
    nxt/@Range[0,100]  (* Harvey P. Dale, Dec 20 2010 *)
  • PARI
    A053000(n)=nextprime(n^2)-n^2  \\ M. F. Hasler, Mar 23 2013
    
  • Python
    from sympy import nextprime
    def a(n): nn = n*n; return nextprime(nn) - nn
    print([a(n) for n in range(94)]) # Michael S. Branicky, Feb 17 2022

Formula

a(n) = A013632(n^2). - Robert Israel, Jul 06 2015

Extensions

More terms from James Sellers, Feb 22 2000

A159829 a(n) is the smallest natural number m such that n^3+m^3+1^3 is prime.

Original entry on oeis.org

1, 2, 1, 2, 1, 4, 15, 2, 3, 2, 11, 10, 9, 2, 7, 14, 5, 4, 9, 2, 15, 2, 7, 16, 15, 8, 13, 2, 1, 10, 3, 4, 15, 2, 11, 10, 9, 2, 7, 6, 13, 22, 5, 2, 1, 6, 29, 10, 29, 10, 3, 2, 11, 12, 3, 8, 3, 2, 19, 6, 15, 8, 1, 2, 1, 18, 5, 2, 1, 18, 1, 12, 17, 14, 15, 26, 7, 6, 3, 2, 19, 12, 1, 18, 3, 8, 15, 2, 11, 6
Offset: 1

Views

Author

Ulrich Krug (leuchtfeuer37(AT)gmx.de), Apr 23 2009

Keywords

Comments

a(2k-1) is odd, a(2k) is even.
Exponent 2: There are infinitely many primes of the forms n^2+m^2 and n^2+m^2+1^2.
Exponent k>2: Are there infinitely many primes of the forms n^k+m^k and n^k+m^k+1^k?

Examples

			2^3+2^3+1=17 = A000040(7); a(2)=2.
7^3+15^3+1=3719 = A000040(519); a(7)=15.
21^3+15^3+1=18523 = A000040(2122), a(21)=15.
		

References

  • L. E. Dickson, History of the Theory of Numbers, Vol, I: Divisibility and Primality, AMS Chelsea Publ., 1999.
  • A. Weil, Number theory: an approach through history, Birkhäuser 1984.
  • David Wells, Prime Numbers: The Most Mysterious Figures in Math. John Wiley and Sons. 2005.

Crossrefs

Cf. A067200 (when m=1).

Programs

  • Maple
    A159829 := proc(n) for m from 1 do if isprime(n^3+m^3+1) then RETURN(m) ; fi; od: end: seq(A159829(n),n=1..120) ; # R. J. Mathar, Apr 28 2009
  • Mathematica
    snn[n_]:=Module[{n3=n^3,m=1},While[!PrimeQ[n3+1+m^3],m++];m]; Array[ snn,100] (* Harvey P. Dale, Sep 04 2019 *)
  • PARI
    a(n) = my(m=1); while (!isprime(n^3+m^3+1^3), m++); m; \\ Michel Marcus, Nov 07 2023

Extensions

Corrected and extended by R. J. Mathar, Apr 28 2009

A129634 Least nonnegative m such that T(n) + T(m) is prime, where T(n) = n*(n+1)/2.

Original entry on oeis.org

2, 1, 0, 1, 1, 7, 4, 1, 1, 7, 3, 1, 1, 3, 16, 13, 1, 4, 4, 1, 1, 4, 4, 1, 46, 3, 7, 1, 2, 7, 16, 2, 13, 4, 3, 1, 13, 3, 4, 22, 1, 16, 16, 1, 1, 7, 3, 1, 10, 3, 7, 1, 2, 7, 16, 2, 1, 4, 4, 13, 1, 4, 16, 1, 1, 16, 4, 2, 1, 16, 8, 1, 10, 3, 7, 1, 1, 31, 7, 2, 13, 4, 4, 10, 1, 8, 7, 13, 1, 43, 16, 5, 25, 16
Offset: 0

Views

Author

Jonathan Vos Post, May 31 2007

Keywords

Comments

What is the simplest proof that this is defined for all nonzero n?
It appears that a(n)A130504 provides evidence that a(n) exists for all n. - T. D. Noe, Jun 04 2007

Examples

			a(6) = 4 because T(4) = 10 is the least triangular number whose sum with T(6) = 21 is prime, since {21+0 = 3*7, 21+3 = 2^3*3, 21+6 = 3^3} are all composite, but 21+10 = 31 is prime.
		

Crossrefs

Cf. A069003 (for square numbers).

Programs

  • Mathematica
    nn=100; tri=Range[0,nn]Range[nn+1]/2; Table[k=1; While[k<=Length[tri] && !PrimeQ[tri[[k]]+tri[[n]]], k++ ]; If[k<=Length[tri], k-1,0], {n,Length[tri]}] (* T. D. Noe, Jun 04 2007 *)

Formula

a(n) = Min{m: m*(m+1)/2 + n*(n+1)/2 is prime}. a(n) = Min{m: A000217(m) + A000217(n) is an element of A000040}.

Extensions

Corrected and extended by T. D. Noe, Jun 04 2007

A068486 Smallest prime equal to n^2 + m^2 with n >= m.

Original entry on oeis.org

2, 5, 13, 17, 29, 37, 53, 73, 97, 101, 137, 193, 173, 197, 229, 257, 293, 349, 397, 401, 457, 509, 593, 577, 641, 677, 733, 809, 857, 1021, 977, 1033, 1093, 1181, 1229, 1297, 1373, 1453, 1621, 1601, 1697, 1789, 1913, 2017, 2029, 2141, 2213, 2473, 2417, 2549
Offset: 1

Views

Author

Lekraj Beedassy, Mar 11 2002

Keywords

Comments

With i being the imaginary unit, the numbers m + ni and m - ni are Gaussian primes. - Alonso del Arte, Feb 07 2011
All terms after the first are congruent to 1 (mod 4). - Carmine Suriano, Mar 30 2011
Any value can occur at most once (a consequence of Alonso del Arte's comment plus unique factorization in the Gaussian integers). - Robert Israel, Aug 19 2014
Smallest prime of the form (x^2 + y^2)/2 such that |x| + |y| = 2n. Note: |x| = n - m and |y| = n + m. - Thomas Ordowski and Altug Alkan, Jan 13 2017

Crossrefs

Cf. A068487. The values of m are given by A069003.

Programs

  • Maple
    for n from 1 to 100 do m := 1:while(not isprime(n^2+m^2)) do m := m+1; end do:a[n] := n^2+m^2:end do:q := seq(a[i],i=1..100);
  • Mathematica
    Table[k = 1; While[p = n^2 + k^2; Not[PrimeQ[p]], k++]; p, {n, 50}] (* Alonso del Arte, Feb 07 2011 *)
  • PARI
    a(n) = for (m=1, n, if (isprime(p=n^2+m^2), return (p))); \\ Michel Marcus, Jan 22 2017

Formula

a(n) = n^2 + A069003(n)^2. - Thomas Ordowski, Aug 19 2014

Extensions

More terms from Sascha Kurz, Mar 17 2002

A159828 a(n) is smallest number m > 0 such that m^2 + n^2 + 1 is prime.

Original entry on oeis.org

1, 6, 1, 6, 9, 2, 3, 6, 1, 6, 3, 2, 3, 6, 1, 6, 27, 8, 9, 24, 1, 6, 21, 4, 69, 12, 3, 6, 21, 6, 3, 6, 1, 6, 9, 2, 9, 6, 1, 6, 15, 6, 9, 6, 1, 6, 27, 2, 3, 36, 9, 6, 3, 6, 15, 18, 1, 48, 3, 4, 9, 6, 7, 6, 15, 4, 21, 42, 5, 6, 3, 2, 69, 18, 5, 6, 3, 2, 9, 24, 1, 6, 3, 8, 9, 6, 11, 18, 15, 4, 3, 6, 7, 18
Offset: 1

Views

Author

Ulrich Krug (leuchtfeuer37(AT)gmx.de), Apr 23 2009

Keywords

Comments

a(2k-1) is odd, a(2k) is even.
There are infinitely many primes of the forms n^2 + m^2 and n^2 + m^2 + 1, but it is not known if the number of primes of the form n^2 + 1 is infinite; cf. comments in A002496, A002313, A079544.

Examples

			n = 1: 1^2 + 1^2 + 1 = 3 is prime, so a(1) = 1.
n = 2: 1^2 + 2^2 + 1 = 6, 2^2 + 2^2 + 1 = 9, 3^2 + 2^2 + 1 = 14, 4^2 + 2^2 + 1 = 21, 5^2 + 2^2 + 1 = 30 are composite, but 6^2 + 2^2 + 1 = 41 is prime, so a(2) = 6.
n = 27: 1^2 + 27^2 + 1 = 731 = 17*43, 2^2 + 27^2 + 1 = 734 = 2*367 are composite, but 3^2 + 27^2 + 1 = 739 is prime, so a(27) = 3.
		

Crossrefs

Cf. A069003 (smallest d such that n^2+d^2 is prime), A002496 (primes of form n^2+1), A002313 (primes of form x^2+y^2), A079544 (primes of form x^2+y^2+1, x>0, y>0).

Programs

  • Magma
    S:=[]; for n in [1..100] do q:=n^2+1; m:=1; while not IsPrime(m^2+q) do m+:=1; end while; Append(~S,m); end for; S; // Klaus Brockhaus, May 21 2009
  • Mathematica
    snm[n_]:=Module[{c=n^2+1,x=NextPrime[n^2+1]},While[!IntegerQ[Sqrt[x-c]], x= NextPrime[x]];Sqrt[x-c]]; Array[snm,100] (* Harvey P. Dale, Sep 22 2018 *)

Extensions

Edited and extended by Klaus Brockhaus, May 21 2009

A227899 Number of primes p < n with 3*p - 4 and n^2 + (n - p)^2 both prime.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 1, 2, 1, 2, 2, 1, 3, 2, 1, 2, 2, 1, 2, 3, 2, 3, 3, 2, 3, 2, 3, 1, 1, 3, 2, 4, 2, 3, 3, 3, 4, 1, 2, 6, 2, 4, 2, 3, 5, 4, 2, 3, 4, 4, 4, 4, 2, 1, 2, 4, 2, 4, 2, 6, 7, 5, 3, 3, 9, 2, 3, 3, 2, 4, 4, 3, 1, 2, 8, 3, 6, 2, 2, 8, 4, 7, 2, 2, 5, 2, 3, 3, 2, 8, 3, 3, 1, 4, 7, 5, 9, 2, 2, 5
Offset: 1

Views

Author

Zhi-Wei Sun, Oct 14 2013

Keywords

Comments

Conjecture: a(n) > 0 for all n > 3.

Examples

			a(5) = 1 since 5 = 3 + 2, and the three numbers 3, 3*3 - 4 = 5 and 5^2 + (5-3)^2 = 29 are all prime.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Sum[If[PrimeQ[3Prime[i]-4]&&PrimeQ[n^2+(n-Prime[i])^2],1,0],{i,1,PrimePi[n-1]}]
    Table[a[n],{n,1,100}]

A284211 a(n) is the least positive integer such that n^2 + a(n)^2 and n^2 + (a(n) + 2)^2 are primes.

Original entry on oeis.org

2, 1, 8, 9, 2, 29, 8, 3, 14, 1, 4, 23, 8, 9, 2, 29, 8, 5, 14, 1, 44, 13, 18, 59, 4, 9, 20, 13, 4, 11, 4, 3, 188, 9, 16, 149, 28, 13, 44, 1, 44, 23, 8, 19, 14, 19, 8, 35, 4, 17, 14, 3, 10, 59, 4, 9, 50, 3, 24, 29, 24, 43, 38, 9, 2, 89, 18, 5, 194, 17, 14, 5
Offset: 1

Views

Author

Lars-Erik Svahn, Mar 23 2017

Keywords

Comments

z = n + i*a(n) and z' = n + i*(a(n) + 2) are two Gaussian primes such that |z - z'| = 2, corresponding to twin primes.

Examples

			a(1)=2: 1^2 + 1^2 = 2 is a prime but 1 + (1 + 2)^2 = 10 is not, while 1^2 + 2^2 = 5 and 1^2 + (2+2)^2 = 17 are both primes.
		

Crossrefs

Cf. A069003.

Programs

  • Maple
    f:= proc(n) local k,pp,p;
        pp:= false;
        for k from (n+1) mod 2 by 2 do
          p:= isprime(n^2 + k^2);
          if p and pp then return k-2 fi;
          pp:= p;
        od;
    end proc:
    map(f, [$1..100]); # Robert Israel, Mar 30 2017
  • Mathematica
    a[n_] := Block[{k = Mod[n, 2] + 1}, While[! PrimeQ[n^2 + k^2] || ! PrimeQ[n^2 + (k + 2)^2], k += 2]; k]; Array[a, 72] (* Giovanni Resta, Mar 23 2017 *)
    lpi[n_]:=Module[{k=1},While[!AllTrue[n^2+{k^2,(k+2)^2},PrimeQ],k++];k]; Array[lpi,80] (* Harvey P. Dale, Aug 15 2024 *)
  • PARI
    a(n) = my(k=n%2+1); while (!(isprime(n^2+k^2) && isprime(n^2+(k+2)^2)), k+=2); k  \\ Michel Marcus, Mar 25 2017

A284346 a(n) is the least positive integer such that n^2 + a(n)^2 and (n + 1)^2 + (a(n) + 1)^2 are primes.

Original entry on oeis.org

2, 1, 8, 1, 4, 1, 2, 3, 16, 3, 6, 7, 8, 1, 4, 1, 22, 5, 6, 3, 4, 17, 18, 5, 4, 1, 32, 5, 10, 29, 4, 27, 8, 15, 18, 1, 2, 15, 10, 3, 4, 247, 8, 15, 14, 19, 22, 35, 6, 19, 4, 27, 10, 11, 8, 1, 2, 5, 40, 13, 44, 127, 58, 61, 28, 1, 22, 13, 10, 19, 6, 7, 8, 15, 4, 9
Offset: 1

Views

Author

Lars-Erik Svahn, Mar 25 2017

Keywords

Comments

n is odd iff a(n) is even.

Examples

			a(1)=2 since (1 + 1)^2 + (1 + 1)^2 is not prime, but 1^2 + 2^2 = 5 and (1 + 1)^2 + (2 + 1)^2 = 13 are prime.
		

Crossrefs

Programs

  • Mathematica
    Rest@ FoldList[Module[{k = 1}, While[Times @@ Boole@ Map[PrimeQ, {#2^2 + k^2, (#2 + 1)^2 + (k + 1)^2}] < 1, k++]; k] &, 1, Range@ 76] (* Michael De Vlieger, Mar 25 2017 *)
  • PARI
    a(n) = my(k=0); while (! (isprime(n^2+k^2) && isprime((n+1)^2+(k+1)^2)), k++); k;  \\ Michel Marcus, Mar 25 2017

A239388 Values of n such that n^2 + d^2 is prime for a record first value of d.

Original entry on oeis.org

1, 3, 8, 9, 12, 23, 30, 48, 63, 114, 141, 408, 651, 1173, 2697, 12639, 30963, 53343, 159537, 283209, 289131, 335511, 601398, 1832421, 2594214, 3533079, 4013361, 15717618, 17449677, 57532827, 186891843, 226385511, 231177657, 242117967
Offset: 1

Views

Author

T. D. Noe, Mar 18 2014

Keywords

Comments

See A239389 for the corresponding values of d.

Crossrefs

Cf. A069003 (least number d such that n^2 + d^2 is prime).

Programs

  • Mathematica
    leastK[n_] := Module[{k = 1}, While[! PrimeQ[n^2 + k^2], k++]; k]; nn = 10000; t = {}; kMax = 0; Do[k = leastK[n]; If[k > kMax, kMax = k; AppendTo[t, {n, k}]], {n, nn}]; Transpose[t][[1]]

Extensions

a(24)-a(31) from Giovanni Resta, Mar 18 2014
a(32)-a(34) from Emmanuel Vantieghem, Jan 13 2017

A239389 The record values of d for the n in A239388.

Original entry on oeis.org

1, 2, 3, 4, 7, 8, 11, 13, 32, 35, 40, 47, 50, 100, 118, 130, 178, 208, 220, 250, 254, 320, 353, 380, 401, 404, 466, 487, 598, 640, 652, 676, 680, 692
Offset: 1

Views

Author

T. D. Noe, Mar 18 2014

Keywords

Crossrefs

Cf. A069003 (least number d such that n^2 + d^2 is prime).

Programs

  • Mathematica
    leastK[n_] := Module[{k = 1}, While[! PrimeQ[n^2 + k^2], k++]; k]; nn = 10000; t = {}; kMax = 0; Do[k = leastK[n]; If[k > kMax, kMax = k; AppendTo[t, {n, k}]], {n, nn}]; Transpose[t][[2]]

Extensions

a(24)-a(31) from Giovanni Resta, Mar 18 2014
a(32)-a(34) from Emmanuel Vantieghem, Jan 13 2017
Showing 1-10 of 18 results. Next