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

A185086 Fouvry-Iwaniec primes: Primes of the form k^2 + p^2 where p is a prime.

Original entry on oeis.org

5, 13, 29, 41, 53, 61, 73, 89, 109, 113, 137, 149, 157, 173, 193, 229, 233, 269, 281, 293, 313, 317, 349, 353, 373, 389, 397, 409, 433, 449, 461, 509, 521, 557, 569, 593, 601, 613, 617, 653, 673, 701, 733, 761, 773, 797, 809, 853, 857, 877, 929, 937, 941, 953
Offset: 1

Views

Author

Keywords

Comments

Sequence is infinite, see Fouvry & Iwaniec.
Its intersection with A028916 is A262340, by the uniqueness part of Fermat's two-squares theorem. - Jonathan Sondow, Oct 05 2015
Named after the French mathematician Étienne Fouvry (b. 1953) and the Polish-American mathematician Henryk Iwaniec (b. 1947). - Amiram Eldar, Jun 20 2021

Crossrefs

Subsequence of A002144 and hence of A002313.
The positive terms of A240130 form a subsequence.

Programs

  • Haskell
    a185086 n = a185086_list !! (n-1)
    a185086_list = filter (\p -> any ((== 1) . a010052) $
                   map (p -) $ takeWhile (<= p) a001248_list) a000040_list
    -- Reinhard Zumkeller, Mar 17 2013
  • Mathematica
    nn = 1000; Union[Reap[Do[n = k^2 + p^2; If[n <= nn && PrimeQ[n], Sow[n]], {k, Sqrt[nn]}, {p, Prime[Range[PrimePi[Sqrt[nn]]]]}]][[2, 1]]]
  • PARI
    is(n)=forprime(p=2,sqrtint(n),if(issquare(n-p^2),return(isprime(n))));0
    
  • PARI
    list(lim)=my(v=List(),N,t);forprime(p=2,sqrt(lim), N=p^2; for(n=1,sqrt(lim-N), if(ispseudoprime(t=N+n^2), listput(v,t)))); v=vecsort(Vec(v),,8); v
    

A240131 Least k such that prime(n)^2 + k^2 is prime, or 0 if none.

Original entry on oeis.org

1, 2, 2, 2, 4, 2, 2, 6, 8, 4, 4, 2, 4, 8, 2, 10, 6, 10, 2, 6, 2, 4, 18, 4, 2, 10, 2, 10, 4, 18, 8, 16, 2, 10, 14, 4, 10, 2, 2, 10, 4, 6, 4, 2, 8, 16, 4, 18, 8, 4, 2, 10, 16, 14, 18, 8, 10, 6, 2, 4, 8, 2, 2, 4, 2, 2, 6, 20, 2, 14, 8, 10, 8, 2, 6, 12, 4, 18, 4, 6, 14, 4, 6, 12, 4, 28, 10, 12, 6, 2, 12, 14, 2, 6, 4, 2, 14, 14, 10, 6
Offset: 1

Views

Author

Jonathan Sondow, Apr 07 2014

Keywords

Comments

The main entry for this sequence is A240130.
k and p_n must be of opposite parity. Conjecture, there is always a k for any p_n. Tested for all primes < 15*10^10. - Robert G. Wilson v, Nov 04 2015
Least k > 0 for which prime(n)+i*k is a Gaussian prime. - Robert Israel, Nov 04 2015

Examples

			Prime(3) = 5 and 5^2 + 1^2 = 26 is not prime but 5^2 + 2^2 = 29 is prime, so a(3) = 2.
		

Crossrefs

Cf. A240130.

Programs

  • Maple
    f:= proc(p) local k; for k from 2 by 2 do if isprime(p^2 + k^2) then return k fi eod nd proc:
    f(2):= 1:
    map(f, select(isprime, [2,seq(2*i+1,i=1..10000)])); # Robert Israel, Nov 04 2015
  • Mathematica
    f[n_] := Block[{k = If[n == 1, 1, 2], p = Prime@ n}, While[ !PrimeQ[k^2 + p^2], k += 2]; k]; Array[f, 100]  (* Robert G. Wilson v, Nov 03 2015 *)
    lk[n_]:=Module[{k=2,n2=n^2},While[!PrimeQ[n2+k^2],k+=2];k]; Join[{1}, Table[ lk[x],{x,Prime[Range[2,100]]}]] (* Harvey P. Dale, Mar 22 2019 *)
  • PARI
    vector(100, n, p = prime(n); k = 1 - p%2; inc = 2; while (!isprime(q=p^2+k^2), k += inc); k; ) \\ Altug Alkan, Nov 04 2015

Formula

a(n)^2 = A240130(n) - prime(n)^2 if a(n) > 0.

A263466 Least k such that prime(n) is the smallest prime p for which k^2 + p^2 is also prime, or 0 if none.

Original entry on oeis.org

1, 2, 4, 12, 14, 48, 178, 44, 152, 66, 224, 272, 496, 322, 408, 2068, 114, 354, 592, 584, 3192, 406, 2708, 774, 2658, 394, 4102, 2432, 3346, 2562, 8722, 4424, 9562, 2986, 6856, 1714, 21318, 5858, 7568, 16272, 7576, 4864, 6244, 29262, 29992, 9996, 10406, 58348, 16872, 11384, 12738, 22126, 9946, 24214, 81682, 46082, 74616, 88016, 6788, 30856, 21542, 38672, 131492, 62874, 75358, 95262, 39554, 83552, 65022, 73664
Offset: 1

Views

Author

Keywords

Comments

The data support the conjecture in A263977 that if k > 0 is even, then k^2 + p^2 is prime for some prime p.
a(n) is the location of the first occurrence of prime(n) in A263978.

Examples

			The primes p < prime(3) = 5 are p = 2 and 3. As 1^2 + 2^2 = 5, 2^2 + 3^2 = 13, and 3^2 + 2^2 = 13 are prime, a(3) >= 4. But 4^2 + 2^2 = 20 and 4^2 + 3^2 = 25 are not prime, while 4^2 + 5^2 = 41 is prime, so a(3) = 4.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = 2}, While[ !PrimeQ[n^2 + p^2], p = NextPrime@ p]; p]; t = 0*Range@ 300; t[[1]] = 1; k = 2; While[k < 50000001, p = f@ k; If[ t[[PrimePi@ p]] == 0, t[[PrimePi@ p]] = k; Print[{PrimePi@ p, p, k}]]; k += 2]; t

A263722 Integers k > 0 such that k^2 + p^2 is composite for all primes p.

Original entry on oeis.org

9, 11, 19, 21, 23, 25, 29, 31, 39, 41, 43, 49, 51, 53, 55, 59, 61, 63, 69, 71, 75, 77, 79, 81, 83, 89, 91, 93, 99, 101, 105, 107, 109, 111, 113, 119, 121, 123, 127, 129, 131, 133, 139, 141, 143, 145, 149, 151, 153, 157, 159, 161, 165, 169, 171, 173, 175, 179, 181, 185, 187, 189, 191, 195, 197, 199
Offset: 1

Views

Author

Keywords

Comments

Conjecture: All terms are odd. An equivalent conjecture in A263977 is that if k > 0 is even, then k^2 + p^2 is prime for some prime p. We have checked this for all k <= 12*10^7.
An odd number k is a term if and only if k^2 + 2^2 is composite, since k^2 + p^2 is even and > 2 (hence composite) for all odd primes p. Thus if the Conjecture is true, then the sequence is simply odd k such that k^2 + 4 is composite. The sequence of odd k, such that k^2 + 4 is prime, is A007591.
The complementary sequence is A263977. Given k in it, the smallest prime p, such that k^2 + p^2 is prime, is in A263726. These numbers k^2 + p^2 form A185086, the Fouvry-Iwaniec primes.

Examples

			9^2 + 2^2 = 85 = 5*17, 11^2 + 2^2 = 125 = 5^3, and 23^2 + 2^2 = 533 = 13*41 are composite, so 9, 11, and 23 are members.
1^2 + 2^2 = 5 and 2^2 + 3^3 = 13 are prime, so 1, 2, and 3 are not members.
		

Crossrefs

A263726 Least prime p such that p^2 + A263977(n)^2 is prime.

Original entry on oeis.org

2, 3, 2, 5, 2, 5, 2, 3, 3, 7, 2, 11, 2, 5, 2, 5, 3, 5, 5, 5, 2, 5, 11, 3, 2, 5, 2, 5, 2, 3, 3, 5, 19, 2, 5, 2, 13, 7, 3, 11, 11, 2, 3, 13, 3, 11, 2, 29, 2, 5, 3, 5, 2, 5, 5, 7, 7, 3, 11, 2, 11, 2, 3, 11, 7, 5, 2, 5, 2, 3, 3, 5, 2, 11, 5, 5, 3, 3, 59, 2, 11, 2, 3, 7, 13, 5, 2, 5, 7
Offset: 1

Views

Author

Keywords

Comments

The least k, such that prime(n) is the smallest prime p for which k^2 + p^2 is also prime, is in A263466.

Examples

			A263977(1) = 1, and 2 and 2^2 + 1^2 = 5 are prime, so a(1) = 2.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = 2}, While[! PrimeQ[n^2 + p^2] && p < 1500, p = NextPrime@ p]; If[p > 1500, 0, p]]; lst = {}; k = 1; While[k < 130, If[f@ k > 0, AppendTo[lst, f@ k]]; k++]; lst

A263977 Integers k > 0 such that k^2 + p^2 is prime for some prime p.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 27, 28, 30, 32, 33, 34, 35, 36, 37, 38, 40, 42, 44, 45, 46, 47, 48, 50, 52, 54, 56, 57, 58, 60, 62, 64, 65, 66, 67, 68, 70, 72, 73, 74, 76, 78, 80, 82, 84, 85, 86, 87, 88, 90, 92, 94, 95, 96, 97, 98, 100, 102, 103, 104, 106, 108, 110, 112, 114, 115, 116, 117, 118, 120, 122, 124, 125, 126
Offset: 1

Views

Author

Keywords

Comments

The smallest such prime p is in A263726.
Complement of A263722.
An odd number k is a member if and only if k^2 + 4 is prime; see A007591.
Conjecture: Every even number k is a member. (This is equivalent to the Conjecture in A263722.) We have checked this for all k <= 12*10^7.

Examples

			1^2 + 2^2 = 5, and 2 and 5 are prime, so a(1) = 1.
9^2 + p^2 is composite for all primes p, so 9 is not a member.
		

Crossrefs

Programs

  • Mathematica
    fQ[n_] := Block[{p = 2}, While[ !PrimeQ[n^2 + p^2] && p < 1500, p = NextPrime@ p]; If[p > 1500, 0, p]]; lst = {}; k = 1; While[k < 130, If[fQ@ k > 0, AppendTo[lst, k]]; k++]; lst

A263721 The prime p in the Fouvry-Iwaniec prime k^2 + p^2 (A185086), or the larger of k and p if both are prime.

Original entry on oeis.org

2, 3, 5, 5, 7, 5, 3, 5, 3, 7, 11, 7, 11, 13, 7, 2, 13, 13, 5, 17, 13, 11, 5, 17, 7, 17, 19, 3, 17, 7, 19, 5, 11, 19, 13, 23, 5, 17, 19, 13, 23, 5, 2, 19, 17, 11, 5, 23, 29, 29, 23, 19, 29, 13, 31, 31, 23, 11, 3, 5, 31, 13, 2, 29, 5, 13, 31, 2, 11, 5, 31, 37, 23, 37, 3, 7, 23, 3, 13, 31, 19, 37, 41, 11
Offset: 1

Views

Author

Keywords

Comments

The sequence is well-defined by the uniqueness part of Fermat's two-squares theorem.
The sequence is infinite, since Fouvry and Iwaniec proved that A185086 is infinite.

Examples

			A185086(2) = 13 = 2^2 + 3^2 and A185086(6) = 61 = 5^2 + 6^2, so a(2) = 3 and a(6) = 5.
		

Crossrefs

Programs

  • Mathematica
    p = 2; lst = {}; While[p < 100, k = 1; While[k < 101, If[PrimeQ[k^2 + p^2], AppendTo[lst, {k^2 + p^2, If[PrimeQ@ k, Max[k, p], p]}]]; k++]; p = NextPrime@ p]; Transpose[Union@ lst][[2]]
  • PARI
    do(lim)=my(v=List(),p2,t); forprime(p=2, sqrtint(lim\=1), p2=p^2; for(k=1, sqrtint(lim-p2), if(isprime(t=p2+k^2), listput(v, [t, if(isprime(k),max(k,p),p)])))); v=vecsort(Set(v),1); apply(u->u[2], v) \\ Charles R Greathouse IV, Aug 21 2017

Formula

a(n)^2 = A185086(n) - k^2 for some integer k > 0.

A263978 Least prime p such that n^2 + p^2 is prime, or 0 if none.

Original entry on oeis.org

2, 3, 2, 5, 2, 5, 2, 3, 0, 3, 0, 7, 2, 11, 2, 5, 2, 5, 0, 3, 0, 5, 0, 5, 0, 5, 2, 5, 0, 11, 0, 3, 2, 5, 2, 5, 2, 3, 0, 3, 0, 5, 0, 19, 2, 5, 2, 13, 0, 7, 0, 3, 0, 11, 0, 11, 2, 3, 0, 13, 0, 3, 0, 11, 2, 29, 2, 5, 0, 3, 0, 5, 2, 5, 0, 5, 0, 7, 0, 7, 0, 3, 0, 11, 2, 11, 2, 3, 0, 11, 0, 7, 0, 5, 2, 5, 2, 3, 0, 3
Offset: 1

Views

Author

Keywords

Comments

When n is odd, n^2 + p^2 is composite for all odd primes p, so a(n) = 2 or 0 according as n^2 + 2^2 is prime or not.
The locations of the zeros are in A263722.
The location of the first occurrence of prime(n) is A263466(n).

Examples

			a(1) = 2 since 1^2 + 2^2 = 5 is prime.
a(2) = 3 since 2^2 + 2^2 = 8 is not prime but 2^2 + 3^2 = 13 is prime.
a(9) = 0 since 9^2 + 2^2 = 85 is not prime.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := If[OddQ[n] && ! PrimeQ[n^2 + 4], 0,
      Block[{p = 2}, While[! PrimeQ[n^2 + p^2] && p < 1500, p = NextPrime@p];
       p]]; Array[f, 100]
Showing 1-8 of 8 results.