login
A005041
A self-generating sequence.
(Formerly M0258)
3
1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18
OFFSET
0,3
COMMENTS
See A008620 for run lengths: each k occurs A008620(k+2) times. - Reinhard Zumkeller, Mar 16 2012
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
James Propp, Problem 1047, Math. Mag., 52 (1979), 265.
Jeffrey Shallit, Letter to N. J. A. Sloane, Nov 10 1979. Attached: James Propp, Problem 1047, Math. Mag., 52 (1979), 265. [Annotated scanned copy]
Aaron Snook, Augmented Integer Linear Recurrences, Thesis, 2012. - From N. J. A. Sloane, Dec 19 2012
FORMULA
For any k in {0, 1, 2, ...} and r in {0, 1, 2}, we have: if n = 6*k + (3/2)*k*(k-1) + r*(k+2), then a(n) = 3*k + r + 1. E.g., for k=3 and r=1, we have n = 6*3 + (3/2)*3*(3-1) + 1*(3+2) = 32 and so a(32) = 3*3 + 1 + 1 = 11. - Francois Jooste (phukraut(AT)hotmail.com), Mar 12 2002
MATHEMATICA
Table[n+1, {n, 0, 20}, {Ceiling[(n+1)/3]+1}] // Flatten (* Jean-François Alcover, Dec 10 2014 *)
PROG
(Haskell)
a005041 n = a005041_list !! n
a005041_list = 1 : f 1 1 (tail ts) where
f y i gs'@((j, a):gs) | i < j = y : f y (i+1) gs'
| i == j = a : f a (i+1) gs
ts = [(6*k + 3*k*(k-1) `div` 2 + r*(k+2), 3*k+r+1) |
k <- [0..], r <- [0, 1, 2]]
-- Reinhard Zumkeller, Mar 16 2012
KEYWORD
nonn,nice,easy
EXTENSIONS
More terms from Samuel Hilliard (sam_spade1977(AT)hotmail.com), Apr 11 2004
STATUS
approved