login
a(n) is the least integer m >= 3 such that n is a centered m-gonal number.
0

%I #11 Mar 11 2023 00:14:48

%S 3,4,5,6,7,8,3,10,11,4,13,14,5,16,17,3,19,20,7,22,23,4,25,26,9,28,29,

%T 3,31,32,11,34,35,6,37,38,13,4,41,7,43,44,3,46,47,8,49,5,17,52,53,9,

%U 55,56,19,58,59,4,61,62,3,64,65,11,67,68,23,7,71,12,73,74,5,76,77,13,79

%N a(n) is the least integer m >= 3 such that n is a centered m-gonal number.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CenteredPolygonalNumber.html">Centered Polygonal Number</a>.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Centered_polygonal_number">Centered polygonal number</a>.

%e a(16) = 5 since 16 is a centered pentagonal number, but not a centered square or centered triangular number.

%t seq[len_] := Module[{s = Table[0, {len}], c = 0, k = 3, n, ckn}, While[c < len, n = 2; While[(ckn = k*n*(n - 1)/2 - 2) <= len, If[s[[ckn]] == 0, c++; s[[ckn]] = k]; n++]; n = 4; k++]; s]; seq[100] (* _Amiram Eldar_, Mar 06 2023 *)

%Y Cf. A101321, A176774, A333914.

%K nonn

%O 4,1

%A _Ilya Gutkovskiy_, Feb 15 2023