login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A064865
Fill a triangular array by rows by writing numbers 1, then 1 up to 2^2, then 1 up to 3^2, then 1 up to 4^2 and so on. The final elements of the rows form the sequence.
17
1, 2, 1, 5, 1, 7, 14, 6, 15, 25, 11, 23, 36, 14, 29, 45, 13, 31, 50, 6, 27, 49, 72, 15, 40, 66, 93, 21, 50, 80, 111, 22, 55, 89, 124, 16, 53, 91, 130, 1, 42, 84, 127, 171, 20, 66, 113, 161, 210, 35, 86, 138, 191, 245, 44, 100, 157, 215, 274, 45, 106, 168, 231, 295, 36
OFFSET
1,2
COMMENTS
Does every number appear at least once? Do some numbers like 1 appear infinitely often? - Robert G. Wilson v, Oct 10 2001
Difference between n-th triangular number and largest square pyramidal number (A000330) less than it. - Franklin T. Adams-Watters, Sep 11 2006
LINKS
FORMULA
a(n) = n(n+1)/2 - max_{p(m) < n(n+1)/2} p(m), where p(m) = m(m+1)(2m+1)/6. - Franklin T. Adams-Watters, Sep 11 2006
EXAMPLE
The triangle begins:
....1
...1.2
..3.4.1
.2.3.4.5
6.7.8.9.1
MATHEMATICA
a = {}; Do[a = Append[a, Table[i, {i, 1, n^2} ]], {n, 1, 100} ]; a = Flatten[a]; Do[Print[a[[n(n + 1)/2]]], {n, 1, 100} ]
With[{nn=20}, TakeList[Flatten[Table[Range[n^2], {n, nn}]], Range[Floor[ (Sqrt[8*nn^3+12*nn^2+4*nn+3]/Sqrt[3]-1)/2]]]][[All, -1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Dec 04 2020 *)
PROG
(Python)
from sympy import integer_nthroot
def A064865(n): return 1+(k:=(n*(n+1)>>1)-1)-(r:=(m:=integer_nthroot(3*k, 3)[0])-(6*k<m*(m+1)*((m<<1)+1)))*(r+1)*((r<<1)+1)//6 # Chai Wah Wu, Nov 05 2024
CROSSREFS
Table: A064866.
Mini-index to these sequences: A064766, A064865, A064866, A065221-A655234 are all of the same type. See A064766 for a detailed explanation.
Sequence in context: A263454 A036073 A124227 * A178472 A337667 A331888
KEYWORD
nonn,look,easy
AUTHOR
Floor van Lamoen, Oct 08 2001
EXTENSIONS
More terms from Robert G. Wilson v, Oct 10 2001
STATUS
approved