[go: up one dir, main page]

login
A122797
A P_3-stuttered arithmetic progression with a(n+1) = a(n) if n is a triangular number, a(n+1) = a(n) + 1 otherwise.
14
1, 1, 2, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 86, 87
OFFSET
1,3
COMMENTS
P_3(i) = the i-th triangular number.
As a triangle [1; 1,2; 2,3,4; ...], row sums = A064808: (1, 3, 9, 22, 45, 81, ...). - Gary W. Adamson, Aug 10 2007
a(n) = n - A003056(n-1). - Reinhard Zumkeller, Feb 12 2012
LINKS
Grady D. Bullington, The Connell Sum Sequence, J. Integer Seq. 10 (2007), Article 07.2.6. (includes direct formula for a(n))
Douglas E. Iannucci and Donna Mills-Taylor, On Generalizing the Connell Sequence, J. Integer Sequences, Vol. 2, 1999, #99.1.7.
J. W. Meijer and M. Nepveu, Euler's ship on the Pentagonal Sea, Acta Nova, Volume 4, No.1, December 2008. pp. 176-187. [From Johannes W. Meijer, Jun 21 2010]
FORMULA
a(n) = A001614(n) - n + 1.
MATHEMATICA
nxt[{n_, a_}]:={n+1, If[OddQ[Sqrt[8n+1]], a, a+1]}; NestList[nxt, {1, 1}, 100][[All, 2]] (* Harvey P. Dale, Oct 10 2018 *)
PROG
(Haskell)
a122797 n = a122797_list !! (n-1)
a122797_list = 1 : zipWith (+) a122797_list (map ((1 -) . a010054) [1..])
-- Reinhard Zumkeller, Feb 12 2012
(PARI) isTriang(n) = {if (! issquare(8*n+1), return (0)); return (1); }
lista(m) = {aa = 1; for (i=1, m, print1(aa, ", "); if (! isTriang(i), aa = aa + 1); ); } \\ Michel Marcus, Apr 01 2013
(Python)
from math import isqrt
def A122797(n): return n+1-(k:=isqrt(m:=n<<1))-int((m<<2)>(k<<2)*(k+1)+1) # Chai Wah Wu, Jul 26 2022
KEYWORD
nonn,easy
AUTHOR
Grady Bullington (bullingt(AT)uwosh.edu), Sep 14 2006
EXTENSIONS
Definition corrected by Michel Marcus, Apr 01 2013
STATUS
approved