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-4 of 4 results.

A056898 a(n) = smallest number m such that m^2+n is prime.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Jul 05 2000

Keywords

Examples

			a(8) = 3 since 3^2+8 = 17 which is prime.
		

Crossrefs

Programs

Formula

a(n) = sqrt(A056896(n)-n) = sqrt(A056897(n)).
For p a prime: a(p) = 0 (and a(p-1) = 1 if p<>3).

A056897 Smallest square where a(n)+n is prime.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Henry Bottomley, Jul 05 2000

Keywords

Examples

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

Crossrefs

Programs

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

Formula

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

A056895 If the smallest prime with a square excess of n is p then a(n)^2 = p - n.

Original entry on oeis.org

1, 1, 2, 3, 6, 5, 4, 9, 8, 7, 6, 7, 10, 15, 8, 9, 24, 11, 12, 21, 16, 13, 12, 13, 16, 15, 14, 17, 18, 31, 20, 27, 20, 23, 18, 19, 22, 21, 20, 23, 24, 23, 24, 27, 28, 29, 30, 25, 38, 39, 26, 31, 30, 35, 28, 45, 34, 31, 42, 31, 34, 33, 32, 33, 36, 35, 34, 75, 40, 37, 36, 41, 48, 45
Offset: 1

Views

Author

Henry Bottomley, Jul 05 2000

Keywords

Examples

			a(4)=3 because the smallest prime with a square excess of 4 is 13 and 13 - 4 = 3^2.
		

Crossrefs

Programs

  • Mathematica
    a = {}; Do[p = 2; While[n != p - (r = Floor@Sqrt[p])^2, p = NextPrime[p]]; AppendTo[a, r], {n, 74}]; a (* Ivan Neretin, May 02 2019 *)
  • PARI
    a(n) = {my(p=2); while(n != p-sqrtint(p)^2, p = nextprime(p+1)); sqrtint(p - n);} \\ Michel Marcus, May 05 2019

Formula

a(n) = sqrt(A056893(n)-n) = A000196(A056893(n)) = sqrt(A056894(n)).

A059843 a(n) is the smallest prime p such that p-n is a nonzero square.

Original entry on oeis.org

2, 3, 7, 5, 41, 7, 11, 17, 13, 11, 47, 13, 17, 23, 19, 17, 53, 19, 23, 29, 37, 23, 59, 73, 29, 107, 31, 29, 173, 31, 47, 41, 37, 43, 71, 37, 41, 47, 43, 41, 617, 43, 47, 53, 61, 47, 83, 73, 53, 59, 67, 53, 89, 79, 59, 137, 61, 59, 383, 61, 97, 71, 67, 73, 101, 67, 71, 149, 73
Offset: 1

Views

Author

Labos Elemer, Feb 26 2001

Keywords

Examples

			For n = 17, let P = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,...} be the set of primes, then P - 17 = {-15,...,-4,0,2,6,12,14,20,24,26,30,36,...}. The first positive square in P - 17 is 36 with p = 53, so a(17) = 53. The square arising here is usually 1.
		

Crossrefs

These terms arise in A002496, A056899, A049423, A005473, A056905, A056909 as first or 2nd entries depending on offset.
Cf. A056896 (where p-n can be 0).

Programs

  • Maple
    SearchLimit := 100;
    for n from 1 to 400 do
    k := 0: c := true:
    while(c and k < SearchLimit) do
        k := k + 1:
        c := not isprime(k^2+n):
    end do:
    if k = SearchLimit then error("Search limit reached!") fi;
    a[n] := k^2 + n end do: seq(a[j], j=1..400);
    # Edited and SearchLimit introduced by Peter Luschny, Feb 05 2019
  • Mathematica
    spsq[n_]:=Module[{p=NextPrime[n]},While[!IntegerQ[Sqrt[p-n]],p= NextPrime[ p]];p]; Array[spsq,70] (* Harvey P. Dale, Nov 10 2017 *)
  • PARI
    for(n=1, 100, for(k=1, 100, if(isprime(k^2+n), print1(k^2+n, ", "); break()))) \\ Jianing Song, Feb 04 2019
    
  • PARI
    a(n) = forprime(p=n,, if ((p-n) && issquare(p-n), return (p))); \\ Michel Marcus, Feb 05 2019

Formula

a(n) = min{p : p - n = x^2 for some x > 0, p is prime}.
Does a(n) exist for all n? - Jianing Song, Feb 04 2019
Showing 1-4 of 4 results.