cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A346004 If n even then n otherwise ((n+1)/2)^2.

This page as a plain text file.
%I A346004 #24 Aug 29 2024 00:54:25
%S A346004 0,1,2,4,4,9,6,16,8,25,10,36,12,49,14,64,16,81,18,100,20,121,22,144,
%T A346004 24,169,26,196,28,225,30,256,32,289,34,324,36,361,38,400,40,441,42,
%U A346004 484,44,529,46,576,48,625,50,676,52,729,54,784,56,841,58,900,60,961,62,1024,64,1089
%N A346004 If n even then n otherwise ((n+1)/2)^2.
%D A346004 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.
%H A346004 Paolo Xausa, <a href="/A346004/b346004.txt">Table of n, a(n) for n = 0..10000</a>
%H A346004 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,3,0,-3,0,1).
%F A346004 G.f.: x*(-1-2*x-x^2+2*x^3) / ( (x-1)^3*(1+x)^3 ). - _R. J. Mathar_, Aug 05 2021
%F A346004 a(n) = ((n^2 + 6*n + 1) - (n-1)^2*(-1)^n)/8. - _Aaron J Grech_, Aug 27 2024
%t A346004 A346004[n_] := If[OddQ[n], (n+1)^2/4, n]; Array[A346004, 100, 0] (* or *)
%t A346004 Riffle[#-2, #^2/4] & [Range[2, 100, 2]] (* _Paolo Xausa_, Aug 28 2024 *)
%o A346004 (Python)
%o A346004 def A346004(n): return ((n+1)//2)**2 if n % 2 else n # _Chai Wah Wu_, Jul 25 2021
%Y A346004 Cf. A125714, A346005-A346007, A346595.
%K A346004 nonn,easy
%O A346004 0,3
%A A346004 _N. J. A. Sloane_, Jul 25 2021