A035214 2 followed by a run of n 1's.
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
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..10000
- Mohammad K. Azarian, Remarks and Conjectures Regarding Combinatorics of Discrete Partial Functions, Int'l Math. Forum (2022) Vol. 17, No. 3, 129-141. See Conjecture 4.5, p. 137.
Programs
-
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 *)
-
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
-
Python
from sympy.ntheory.primetest import is_square def A035214(n): return int(is_square((n<<3)|1))+1 # Chai Wah Wu, Jun 07 2025
Formula
a(n) = 2 if n is a triangular number, otherwise 1.
Equals A010054(n) + 1.
a(n) = floor((3-cos(Pi*sqrt(8*n+1)))/2). - Carl R. White, Mar 18 2006
Extensions
Typo corrected by Neven Juric, Jan 10 2009