login
A346004
If n even then n otherwise ((n+1)/2)^2.
6
0, 1, 2, 4, 4, 9, 6, 16, 8, 25, 10, 36, 12, 49, 14, 64, 16, 81, 18, 100, 20, 121, 22, 144, 24, 169, 26, 196, 28, 225, 30, 256, 32, 289, 34, 324, 36, 361, 38, 400, 40, 441, 42, 484, 44, 529, 46, 576, 48, 625, 50, 676, 52, 729, 54, 784, 56, 841, 58, 900, 60, 961, 62, 1024, 64, 1089
OFFSET
0,3
REFERENCES
J. H. Conway and R. K. Guy, The Book of Numbers, Copernicus Press, NY, 1996. Sequence can be seen in the circled numbers at foot of page 63.
FORMULA
G.f.: x*(-1-2*x-x^2+2*x^3) / ( (x-1)^3*(1+x)^3 ). - R. J. Mathar, Aug 05 2021
a(n) = ((n^2 + 6*n + 1) - (n-1)^2*(-1)^n)/8. - Aaron J Grech, Aug 27 2024
MATHEMATICA
A346004[n_] := If[OddQ[n], (n+1)^2/4, n]; Array[A346004, 100, 0] (* or *)
Riffle[#-2, #^2/4] & [Range[2, 100, 2]] (* Paolo Xausa, Aug 28 2024 *)
PROG
(Python)
def A346004(n): return ((n+1)//2)**2 if n % 2 else n # Chai Wah Wu, Jul 25 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Jul 25 2021
STATUS
approved