OFFSET
0,7
COMMENTS
LINKS
Peter Luschny, Table of n, a(n) for n = 0..10000
EXAMPLE
Illustrating the linear storage layout of a sequence of regular triangles.
(A) [ 0], [ 2, 3], [ 7, 8, 9], [16, 17, 18, 19], [30, 31, 32, 33, 34], ...
(B) [ 1], [ 5, 6], [13, 14, 15], [26, 27, 28, 29], ...
(C) [ 4], [11, 12], [23, 24, 25], ...
(D) [10], [21, 22], ...
(E) [20], ...
...
The first column is A000292.
The start values of all partial rows (in ascending order) are 0 plus A014370.
The start values of the partial rows in the first row are A005581 (without first 0).
The start values of the partial rows on the main diagonal are A331987.
The end values of all partial rows (in ascending order) are A332023.
The end values of the partial rows in the first row are A062748.
The end values of the partial rows on the main diagonal are A332698.
MAPLE
count := (k, A) -> ListTools:-Occurrences(k, A): t := n -> n*(n+1)/2:
PutAndCount := proc(N) local L, n, v, c, seq; L := NULL; seq := NULL;
for n from 1 to N do
for v from 0 to t(n)-1 do
# How often did you see v in this sequence before?
c := count(v, [seq]);
L := L, v, c; seq := seq, v;
od od; L end: PutAndCount(6);
# Returning 'seq' instead of 'L' gives the x-coordinates (A332663).
MATHEMATICA
t[n_] := n*(n+1)/2;
PutAndCount[N_] := Module[{L, n, v, c, seq},
L = {}; seq = {};
For[n = 1, n <= N, n++,
For[v = 0, v <= t[n]-1, v++,
c = Count[seq, v];
L = Join[L, {v, c}]; seq = Append[seq, v]
]]; L];
PutAndCount[6] (* Jean-François Alcover, Oct 13 2024, after Maple program *)
PROG
(Julia)
function a_list(N)
a = Int[]
for n in 1:N
i = 0
for j in ((k:-1:1) for k in 1:n)
t = n - j[1]
for m in j
push!(a, i, t)
i += 1
end end end; a end
a_list(5) |> println
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Feb 18 2020
STATUS
approved