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

A069003 Smallest integer d such that n^2 + d^2 is a prime number.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 2, 3, 4, 1, 4, 7, 2, 1, 2, 1, 2, 5, 6, 1, 4, 5, 8, 1, 4, 1, 2, 5, 4, 11, 4, 3, 2, 5, 2, 1, 2, 3, 10, 1, 4, 5, 8, 9, 2, 5, 2, 13, 4, 7, 4, 3, 10, 1, 4, 1, 2, 3, 6, 13, 10, 3, 32, 9, 2, 1, 2, 5, 10, 3, 6, 5, 2, 1, 4, 5, 10, 7, 4, 7, 4, 3, 18, 1, 2, 9, 2, 3, 4, 1, 4, 7, 8, 1, 2, 5, 2, 3, 4, 3
Offset: 1

Views

Author

T. D. Noe, Apr 02 2002

Keywords

Comments

With i being the imaginary unit, n + di is the smallest Gaussian prime with real part n and a positive imaginary part. Likewise for n - di. See A002145 for Gaussian primes with imaginary part 0. - Alonso del Arte, Feb 07 2011
Conjecture: a(n) does not exceed 4*sqrt(n+1) for any positive integer n. - Zhi-Wei Sun, Apr 15 2013
Conjecture holds for the first 15*10^6 terms. - Joerg Arndt, Aug 19 2014
Infinitely many d exist such that n^2 + d^2 is prime, under Schinzel's Hypothesis H; see Sierpinski (1988), p. 221. - Jonathan Sondow, Nov 09 2015

Examples

			a(5)=2 because 2 is the smallest integer d such that 5^2+d^2 is a prime number.
		

References

  • W. Sierpinski, Elementary Theory of Numbers, 2nd English edition, revised and enlarged by A. Schinzel, Elsevier, 1988.

Crossrefs

Cf. A068486 (lists the prime numbers n^2 + d^2).
Cf. A239388, A239389 (record values).
Cf. A053000.

Programs

  • Maple
    f:= proc(n) local d;
         for d from 1+(n mod 2) by 2 do
           if isprime(n^2+d^2) then return d fi
         od
    end proc:
    f(1):= 1:
    map(f, [$1..1000]); # Robert Israel, Jul 06 2015
  • Mathematica
    imP4P[n_] := Module[{k = 1}, While[Not[PrimeQ[n^2 + k^2]], k++]; k]; Table[imP4P[n], {n, 50}] (* Alonso del Arte, Feb 07 2011 *)
  • PARI
    a(n)=my(k);while(!isprime(n^2+k++^2),);k \\ Charles R Greathouse IV, Mar 20 2013

A281229 Smallest number k of the form x^2 + y^2 with 0 <= x <= y such that gcd(x, y) = 1, x + y = n, and k has no other decompositions into a sum of two squares.

Original entry on oeis.org

1, 2, 5, 10, 13, 26, 29, 34, 41, 58, 61, 74, 89, 106, 113, 146, 149, 194, 181, 202, 233, 274, 269, 386, 313, 346, 389, 394, 421, 458, 521, 514, 557, 586, 613, 698, 709, 794, 761, 802, 853, 914, 929, 1018, 1013, 1186, 1109, 1154, 1201, 1282, 1301, 1354, 1409
Offset: 1

Views

Author

Thomas Ordowski, Jan 18 2017

Keywords

Comments

Conjecture: for each n there exists such a number k.
Note: a(2m+1) > 1 is a prime p and a(2m) > 2 is a double prime 2q, where p and q are primes == 1 (mod 4).
For odd n > 1, a(n) is the smallest prime of the form x^2 + (n - x)^2.
For even n > 2, a(n) is the smallest double prime of the above form.

Crossrefs

Programs

  • Maple
    f:= proc(n) local k,v;
      for k from ceil(n/2) to n do
        v:= k^2+(n-k)^2;
        if n::odd then if isprime(v) then return v fi
        elif isprime(v/2) then return v
        fi
      od;
      FAIL
    end proc:
    f(1):=1: f(2):= 2:
    map(f, [$1..100]); # Robert Israel, Dec 30 2020
  • PARI
    isok(k, n) = {nba = 0; nbb = 0; for (x=0, k, if (issquare(x) && issquare(k-x), if (x <= k - x, nba++; if (nba > 1, return (0)); rx = sqrtint(x); ry = sqrtint(k-x); if ((gcd(rx,ry)==1) && (rx+ry == n), nbb++;);););); if (nbb, return (k), return(0));}
    a(n) = {k = 1; while (! (s = isok(k, n)), k++; ); s;} \\ Michel Marcus, Jan 20 2017

Formula

For m > 0, a(2m+1) = A159351(m).
For m > 1, a(2m) = 2 * A068486(m).

Extensions

More terms from Altug Alkan, Jan 18 2017
More terms from Jon E. Schoenfield, Jan 18 2017
Showing 1-2 of 2 results.