A175032 a(n) is the difference between the n-th triangular number and the next perfect square.
0, 0, 1, 3, 6, 1, 4, 8, 0, 4, 9, 15, 3, 9, 16, 1, 8, 16, 25, 6, 15, 25, 3, 13, 24, 36, 10, 22, 35, 6, 19, 33, 1, 15, 30, 46, 10, 26, 43, 4, 21, 39, 58, 15, 34, 54, 8, 28, 49, 0, 21, 43, 66, 13, 36, 60, 4, 28, 53, 79, 19, 45, 72, 9, 36, 64, 93, 26, 55, 85, 15, 45, 76, 3, 34, 66, 99, 22
Offset: 0
Links
- Seiichi Manyama, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
Mathematica
Ceiling[Sqrt[#]]^2-#&/@Accumulate[Range[0,80]] (* Harvey P. Dale, Aug 25 2013 *)
-
PARI
a(n) = my(t=n*(n+1)/2); if (issquare(t), 0, (sqrtint(t)+1)^2 - t); \\ Michel Marcus, Nov 06 2022
Formula
a(n) = (ceiling(sqrt(n*(n+1)/2)))^2 - n*(n+1)/2. - Ctibor O. Zizka, Nov 09 2009
Extensions
Erroneous formula variant deleted and offset set to zero by R. J. Mathar, Aug 24 2010
Comments