The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A362222 Slowest increasing sequence where a(n) + n^2 is a prime. 1
1, 3, 4, 7, 12, 17, 18, 19, 20, 27, 28, 29, 30, 31, 32, 37, 42, 43, 48, 49, 50, 57, 58, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 93, 96, 97, 100, 103, 104, 105, 124, 133, 138, 147, 148, 153, 154, 163, 166, 171, 184, 193, 196, 197, 198, 205 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
a(2) = 3, since the smallest number greater than all the previous terms which gives a prime when added to 2^2 is 3.
MAPLE
R:= 1: t:= 1:
for n from 2 to 100 do
t:= nextprime(t+n^2)-n^2;
R:= R, t
od:
R; # Robert Israel, Apr 11 2023
MATHEMATICA
a[n_] := a[n] = Module[{k = a[n - 1] + 1}, While[! PrimeQ[n^2 + k], k++]; k]; a[0] = 0; Array[a, 100] (* Amiram Eldar, Apr 12 2023 *)
PROG
(PARI) seq(n)={my(a=vector(n), p=0); for(n=1, #a, p++; while(!isprime(p+n^2), p++); a[n]=p); a} \\ Andrew Howroyd, Apr 11 2023
(Python)
from sympy import nextprime
from itertools import count, islice
def agen(): # generator of terms
an = 1
for n in count(2):
yield an
an = nextprime(an + n**2) - n**2
print(list(islice(agen(), 62))) # Michael S. Branicky, Apr 16 2023
CROSSREFS
Sequence in context: A256726 A130324 A020677 * A310007 A158237 A117950
KEYWORD
nonn
AUTHOR
Angad Singh, Apr 11 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 19 14:45 EDT 2024. Contains 372698 sequences. (Running on oeis4.)