|
|
A035214
|
|
2 followed by a run of n 1's.
|
|
5
|
|
|
2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 2 if n is a triangular number, otherwise 1.
a(n) = floor((3-cos(Pi*sqrt(8*n+1)))/2). - Carl R. White, Mar 18 2006
|
|
MATHEMATICA
|
Table[(SquaresR[1, 8*n + 1] + 2)/2, {n, 0, 100}] (* or *) Table[Floor[(3 - Cos[Pi*Sqrt[8*n + 1]])/2], {n, 0, 100}] (* G. C. Greubel, May 14 2017 *)
|
|
PROG
|
(PARI) for(n=0, 100, print1(floor((3-cos(Pi*sqrt(8*n+1)))/2), ", ")) \\ G. C. Greubel, May 14 2017
(PARI) a(n) = issquare(n<<3 + 1) + 1; \\ Kevin Ryde, Aug 03 2022
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Typo corrected by Neven Juric, Jan 10 2009
|
|
STATUS
|
approved
|
|
|
|