Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #40 Nov 19 2024 22:11:35
%S 1,4,1,10,5,2,4,14,1,12,3,2,3,9,1,31,2,1,15,7,5,6,2,3,12,20,1,19,11,2,
%T 2,5,3,4,9,1,1,15,1,54,1,1,20,4,3,12,1,6,7,3,4,11,1,2,16,10,1,22,6,2,
%U 1,3,2,3,14,1,1,9,1,2,13,1,1,2,2,17,5,1,11,28,2,7,1,10,4,15
%N Goldbach's problem extended to squares of prime gaps (>=2): smallest integer >= ((A078587(n) - A078496(n))^2)/n for n >= 4.
%C Where A078587(n) + A078496(n) = 2n and A078587(n) < A078496(n).
%e a(5) = 4 because ((A078587(5) - A078496(5))^2)/5 = ((3 - 7)^2)/5 < 4, where 3 (prime) = 7 (prime) = 2*5;
%e a(6) = 1 because ((A078587(6) - A078496(6))^2)/6 = ((5 - 7)^2)/6 < 1, where 5 (prime) + 7 (prime) = 2*6;
%e a(7) = 10 because ((A078587(7) - A078496(7))^2)/7 = ((3 - 11)^2)/7 < 10, where 3 (prime) + 11 (prime) = 2*7.
%t Table[k = 1; While[k < ((Last@ # - First@ #)^2)/n, k++] &@ Block[{p = n + 1, q}, q = 2 n - p; While[q > 0 && Nand[PrimeQ@ p, PrimeQ@ q], p++; q--]; {p, q}]; k, {n, 4, 89}] (* or *)
%t Table[Ceiling[4 (n - #)^2/n] &@ Block[{p = n + 1, q}, q = 2 n - p; While[q > 0 && Nand[PrimeQ@ p, PrimeQ@ q], p++; q--]; p], {n, 4, 89}] (* _Michael De Vlieger_, Oct 26 2016, after _T. D. Noe_ at A078587 and _Michel Marcus_ PARI *)
%o (PARI) maxp(n) = {my(p = precprime(n-1)); while(!isprime(2*n-p), p = precprime(p-1)); p;}
%o a(n) = ceil(4*(n - maxp(n))^2/n); \\ _Michel Marcus_, Oct 22 2016
%Y Cf. A002375, A078496, A078587, A277581 (Goldbach's problem extended to squares of prime gaps >= 0).
%K nonn,changed
%O 4,2
%A _Juri-Stepan Gerasimov_, Oct 22 2016