%I #69 Feb 03 2022 16:34:26
%S 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,
%T 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,
%U 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
%N a(n) = m-p where m = (2n+1)^2 and p is the largest prime < m.
%C 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.
%C Legendre's conjecture implies a(n) <= 4*n. Oppermann's conjecture implies a(n) <= 2*n. - _Robert Israel_, Sep 04 2019
%C All terms are even. - _Alois P. Heinz_, Sep 04 2019
%H Harvey P. Dale, <a href="/A323741/b323741.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = A049711(A016754(n)).
%e When n=4, m=81, p=79, so a(4) = 81-79 = 2.
%p seq((2*n+1)^2-prevprime((2*n+1)^2),n=1..100); # _Robert Israel_, Sep 04 2019
%t mp[n_]:=Module[{m=(2n+1)^2},m-NextPrime[m,-1]]; Array[mp, 100] (* _Harvey P. Dale_, Feb 03 2022 *)
%o (VBA/Excel)
%o Sub A323741()
%o For n = 1 To 100
%o Cells(n, 1) = (2 * n + 1) ^ 2
%o k = Cells(n, 1) - 2
%o k1 = (2 * n - 1) ^ 2 + 2
%o For p = k To k1 Step -2
%o IsPrime = True
%o For i = 2 To Int(Sqr(p))
%o If p mod i = 0 Then
%o IsPrime = False
%o Exit For
%o End If
%o Next i
%o If IsPrime Then
%o Cells(n, 2) = p
%o Cells(n, 3) = Cells(n, 1) - Cells(n, 2)
%o Exit For
%o End If
%o Next p
%o Next n
%o End Sub
%o (PARI) a(n) = (2*n+1)^2 - precprime((2*n+1)^2 - 1); \\ _Michel Marcus_, Sep 05 2019
%Y Cf. A016754, A049711, A088572, A089166, A151799.
%K nonn
%O 1,1
%A _Ali Sada_, Sep 03 2019
|