cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A332662 Put-and-count: An enumeration of N X N where N = {0, 1, 2, ...}. The terms are interleaved x and y coordinates. Or: A row-wise storage scheme for sequences of regular triangles.

This page as a plain text file.
%I A332662 #27 Oct 13 2024 07:06:14
%S A332662 0,0,0,1,1,0,2,0,0,2,1,1,2,1,3,0,4,0,5,0,0,3,1,2,2,2,3,1,4,1,5,1,6,0,
%T A332662 7,0,8,0,9,0,0,4,1,3,2,3,3,2,4,2,5,2,6,1,7,1,8,1,9,1,10,0,11,0,12,0,
%U A332662 13,0,14,0,0,5,1,4,2,4,3,3,4,3,5,3,6,2,7,2
%N A332662 Put-and-count: An enumeration of N X N where N = {0, 1, 2, ...}. The terms are interleaved x and y coordinates. Or: A row-wise storage scheme for sequences of regular triangles.
%C A332662 Other enumerations of N X N designed with storage allocation for extensible arrays in mind include A319514 and A319571.
%H A332662 Peter Luschny, <a href="/A332662/b332662.txt">Table of n, a(n) for n = 0..10000</a>
%e A332662 Illustrating the linear storage layout of a sequence of regular triangles.
%e A332662 (A) [ 0], [ 2,  3], [ 7,  8,  9], [16, 17, 18, 19], [30, 31, 32, 33, 34], ...
%e A332662 (B) [ 1], [ 5,  6], [13, 14, 15], [26, 27, 28, 29], ...
%e A332662 (C) [ 4], [11, 12], [23, 24, 25], ...
%e A332662 (D) [10], [21, 22], ...
%e A332662 (E) [20], ...
%e A332662 ...
%e A332662 The first column is A000292.
%e A332662 The start values of all partial rows (in ascending order) are 0 plus A014370.
%e A332662 The start values of the partial rows in the first row are A005581 (without first 0).
%e A332662 The start values of the partial rows on the main diagonal are A331987.
%e A332662 The end values of all partial rows (in ascending order) are A332023.
%e A332662 The end values of the partial rows in the first row are A062748.
%e A332662 The end values of the partial rows on the main diagonal are A332698.
%p A332662 count := (k, A) -> ListTools:-Occurrences(k, A): t := n -> n*(n+1)/2:
%p A332662 PutAndCount := proc(N) local L, n, v, c, seq; L := NULL; seq := NULL;
%p A332662 for n from 1 to N do
%p A332662    for v from 0 to t(n)-1 do
%p A332662      # How often did you see v in this sequence before?
%p A332662      c := count(v, [seq]);
%p A332662      L := L, v, c; seq := seq, v;
%p A332662 od od; L end:  PutAndCount(6);
%p A332662 # Returning 'seq' instead of 'L' gives the x-coordinates (A332663).
%t A332662 t[n_] := n*(n+1)/2;
%t A332662 PutAndCount[N_] := Module[{L, n, v, c, seq},
%t A332662 L = {}; seq = {};
%t A332662 For[n = 1, n <= N, n++,
%t A332662    For[v = 0, v <= t[n]-1, v++,
%t A332662       c = Count[seq, v];
%t A332662       L = Join[L, {v, c}]; seq = Append[seq, v]
%t A332662 ]]; L];
%t A332662 PutAndCount[6] (* _Jean-François Alcover_, Oct 13 2024, after Maple program *)
%o A332662 (Julia)
%o A332662 function a_list(N)
%o A332662     a = Int[]
%o A332662     for n in 1:N
%o A332662         i = 0
%o A332662         for j in ((k:-1:1) for k in 1:n)
%o A332662             t = n - j[1]
%o A332662             for m in j
%o A332662                 push!(a, i, t)
%o A332662                 i += 1
%o A332662 end end end; a end
%o A332662 a_list(5) |> println
%Y A332662 A332663 (x-coordinates), A056559 (y-coordinates).
%Y A332662 Cf. A000292, A014370, A002260, A005581, A319514, A319571, A331987.
%Y A332662 Cf. A332023, A062748, A332698.
%K A332662 nonn
%O A332662 0,7
%A A332662 _Peter Luschny_, Feb 18 2020