A101776 Smallest k such that k^2 is equal to the sum of n not-necessarily-distinct primes plus 1.
1, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
Offset: 0
Keywords
Links
- Jinyuan Wang, Table of n, a(n) for n = 0..1000
Programs
-
Mathematica
iMax[k_,n_]:=PrimePi[k^2-2*n+1] f[k_,n_]:=IntegerPartitions[k^2-1,{n},Table[Prime[i],{i,1,iMax[k,n]}]] a[n_]:=Module[{k=1},While[f[k,n]=={},k++];k] Table[a[n],{n,0,100}] (* Luc Rousseau, Dec 30 2019 *)
-
PARI
a(n) = ceil(sqrt(2*n+1)); \\ Jinyuan Wang, Jan 28 2020
Formula
a(n) = sqrt(A100555(n)).
a(n) = ceiling(sqrt(2*n+1)). - Mohammad K. Azarian, Jun 15 2016 [Proof: for any k > 1 and 1 <= m <= 2*k, a(2*k^2-2*k+m) = 2*k because (2*k-1)^2 < 2*(2*k^2-2*k+m) + 1 and (2*k)^2 = 2*(2*k^2-6*k+3*m+1) + 3*(4*k-2*m-1) + 1; a(2*k^2+m) = 2*k + 1 because (2*k)^2 < 2*(2*k^2+m) + 1 and (2*k+1)^2 = 2*(2*k^2-4*k+3*m) + 3*(4*k-2*m) + 1. Therefore, a(n) = ceiling(sqrt(2*n+1)) for n >= 5. Note that the formula is also correct for n < 5, hence a(n) = ceiling(sqrt(2*n+1)). - Jinyuan Wang, Jan 28 2020]
Comments