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!)
A323741 a(n) = m-p where m = (2n+1)^2 and p is the largest prime < m. 1
2, 2, 2, 2, 8, 2, 2, 6, 2, 2, 6, 6, 2, 2, 8, 2, 2, 2, 10, 12, 2, 8, 2, 2, 8, 6, 2, 20, 12, 2, 2, 6, 6, 2, 2, 6, 2, 2, 12, 8, 6, 6, 8, 2, 8, 2, 12, 6, 10, 8, 2, 22, 2, 14, 20, 6, 6, 2, 2, 2, 8, 6, 2, 8, 2, 6, 2, 12, 2, 14, 6, 2, 8, 8, 14, 10, 2, 18, 20, 2, 8, 14, 6, 2, 10, 2, 32, 2, 12, 12, 2, 8, 6, 44, 2, 6, 14, 6, 20, 14 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
a(n) cannot be a square: suppose a(n) = k^2; then p=m-a(n) could be factored as (2n+k-1)*(2n-k-1); hence it would not be a prime.
Legendre's conjecture implies a(n) <= 4*n. Oppermann's conjecture implies a(n) <= 2*n. - Robert Israel, Sep 04 2019
All terms are even. - Alois P. Heinz, Sep 04 2019
LINKS
FORMULA
a(n) = A049711(A016754(n)).
EXAMPLE
When n=4, m=81, p=79, so a(4) = 81-79 = 2.
MAPLE
seq((2*n+1)^2-prevprime((2*n+1)^2), n=1..100); # Robert Israel, Sep 04 2019
MATHEMATICA
mp[n_]:=Module[{m=(2n+1)^2}, m-NextPrime[m, -1]]; Array[mp, 100] (* Harvey P. Dale, Feb 03 2022 *)
PROG
(VBA/Excel)
Sub A323741()
For n = 1 To 100
Cells(n, 1) = (2 * n + 1) ^ 2
k = Cells(n, 1) - 2
k1 = (2 * n - 1) ^ 2 + 2
For p = k To k1 Step -2
IsPrime = True
For i = 2 To Int(Sqr(p))
If p mod i = 0 Then
IsPrime = False
Exit For
End If
Next i
If IsPrime Then
Cells(n, 2) = p
Cells(n, 3) = Cells(n, 1) - Cells(n, 2)
Exit For
End If
Next p
Next n
End Sub
(PARI) a(n) = (2*n+1)^2 - precprime((2*n+1)^2 - 1); \\ Michel Marcus, Sep 05 2019
CROSSREFS
Sequence in context: A327641 A066874 A087577 * A168281 A203610 A294873
KEYWORD
nonn
AUTHOR
Ali Sada, Sep 03 2019
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 June 6 19:21 EDT 2024. Contains 373134 sequences. (Running on oeis4.)