%I #45 Dec 07 2024 14:57:16
%S 8,1,24,8,40,3,56,16,72,5,88,24,104,7,120,32,136,9,152,40,168,11,184,
%T 48,200,13,216,56,232,15,248,64,264,17,280,72,296,19,312,80,328,21,
%U 344,88,360,23,376,96,392,25,408,104,424,27,440,112,456,29,472
%N Smallest multiplier which can complete the square for n-polygonal numbers, together with a constant offset.
%C This smallest multiplier is also the only multiplier that is relatively prime to the offset.
%C The n-polygonal numbers, indexed by x, are P(n,x) = (n-2)*(x-1)*x/2 + x = A139601(n-3,x).
%C S(x) = P(n,x)*a(n) + A181318(n-4) completes the square in that quadratic, ensuring S(x) is a square for all x.
%H Paolo Xausa, <a href="/A377851/b377851.txt">Table of n, a(n) for n = 3..10000</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Completing_the_square">Completing the square</a>.
%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,2,0,0,0,-1).
%F a(n) = 8*(n-2)/gcd(n,4)^2. - _Andrew Howroyd_, Nov 10 2024
%F From _Stefano Spezia_, Nov 13 2024: (Start)
%F G.f.: x^3*(8 + x + 24*x^2 + 8*x^3 + 24*x^4 + x^5 + 8*x^6)/(1 - x^4)^2.
%F E.g.f.: (4 + 32*x + 6*cos(x) + 2*(16*x - 5)*cosh(x) + 3*x*sin(x) + (5*x - 64)*sinh(x))/4. (End)
%e For n=7, the heptagonal numbers are h(x) = x*(5*x-3)/2 and with multiplier a(7) = 40 and offset A181318(7-4) = 9 become 40*h(x)+9 = (10*x - 3)^2.
%t Table[8*(n - 2)/GCD[n, 4]^2, {n, 3, 100}] (* _Paolo Xausa_, Dec 07 2024 *)
%o (PARI) a(n) = 8*(n-2)/gcd(n,4)^2 \\ _Andrew Howroyd_, Nov 10 2024
%Y Cf. A181318 (offsets).
%K nonn,easy
%O 3,1
%A _Jonathan Dushoff_, Nov 09 2024