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.

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

This page as a plain text file.
%I A263978 #6 Nov 07 2015 17:03:52
%S A263978 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,
%T A263978 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,
%U A263978 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
%N A263978 Least prime p such that n^2 + p^2 is prime, or 0 if none.
%C A263978 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.
%C A263978 The locations of the zeros are in A263722.
%C A263978 The location of the first occurrence of prime(n) is A263466(n).
%e A263978 a(1) = 2 since 1^2 + 2^2 = 5 is prime.
%e A263978 a(2) = 3 since 2^2 + 2^2 = 8 is not prime but 2^2 + 3^2 = 13 is prime.
%e A263978 a(9) = 0 since 9^2 + 2^2 = 85 is not prime.
%t A263978 f[n_] := If[OddQ[n] && ! PrimeQ[n^2 + 4], 0,
%t A263978   Block[{p = 2}, While[! PrimeQ[n^2 + p^2] && p < 1500, p = NextPrime@p];
%t A263978    p]]; Array[f, 100]
%Y A263978 Cf. A240130, A240131, A263466, A263721, A263722, A263726, A263977.
%K A263978 nonn
%O A263978 1,1
%A A263978 _Jonathan Sondow_ and _Robert G. Wilson v_, Nov 06 2015