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.

Showing 1-7 of 7 results.

A319289 The x coordinates of the shell enumeration of N X N where N = {0, 1, 2, ...} (A319514).

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 2, 1, 0, 0, 1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5
Offset: 0

Views

Author

Peter Luschny, Sep 23 2018

Keywords

Comments

See A319514 for comments and references.

Crossrefs

Cf. A319514.

Programs

  • Julia
    function A319289(n)
        m = x = isqrt(n)
        y = n - x^2
        x <= y && ((x, y) = (2x - y, x))
        isodd(m) ? y : x
    end

A319290 The y coordinates of the shell enumeration of N X N where N = {0, 1, 2, ...}(A319514).

Original entry on oeis.org

0, 1, 1, 0, 0, 1, 2, 2, 2, 3, 3, 3, 3, 2, 1, 0, 0, 1, 2, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9
Offset: 0

Views

Author

Peter Luschny, Sep 23 2018

Keywords

Comments

See A319514 for comments and references.

Crossrefs

Cf. A319514.

Programs

  • Julia
    function A319290(n)
        m = x = isqrt(n)
        y = n - x^2
        x <= y && ((x, y) = (2x - y, x))
        isodd(m) ? x : y
    end

A319571 The stripe enumeration of N X N where N = {0, 1, 2, ...}, also called boustrophedonic Cantor enumeration. Terms are interleaved x and y coordinates.

Original entry on oeis.org

0, 0, 0, 1, 1, 0, 2, 0, 1, 1, 0, 2, 0, 3, 1, 2, 2, 1, 3, 0, 4, 0, 3, 1, 2, 2, 1, 3, 0, 4, 0, 5, 1, 4, 2, 3, 3, 2, 4, 1, 5, 0, 6, 0, 5, 1, 4, 2, 3, 3, 2, 4, 1, 5, 0, 6, 0, 7, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 7, 0, 8, 0, 7, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1
Offset: 0

Views

Author

Peter Luschny, Sep 23 2018

Keywords

Comments

If (x, y) and (x', y') are adjacent points on the trajectory of the map then max(|x - x'|, |y - y'|) is always 1 whereas for the Cantor enumeration this quantity can become arbitrarily large. In this sense our boustrophedonic variant is continuous whereas Cantor's realization is not.
We implemented the recursive enumeration as a state machine with two states to avoid the evaluation of the square root function.
The inverse function, computing n for given (x, y), is (x + y)*(x + y + 1)/2 + p where p = x if x - y is odd and y otherwise.

Examples

			The map starts, for n = 0, 1, 2, ...
(0, 0), (0, 1), (1, 0), (2, 0), (1, 1), (0, 2), (0, 3), (1, 2), (2, 1), (3, 0),
(4, 0), (3, 1), (2, 2), (1, 3), (0, 4), (0, 5), (1, 4), (2, 3), (3, 2), (4, 1),
(5, 0), (6, 0), (5, 1), (4, 2), (3, 3), (2, 4), (1, 5), (0, 6), (0, 7), (1, 6),
(2, 5), (3, 4), (4, 3), (5, 2), (6, 1), (7, 0), ...
The enumeration can be seen as diagonal stripes layering on the origin:
(0, 0),
(0, 1), (1, 0),
(2, 0), (1, 1), (0, 2),
(0, 3), (1, 2), (2, 1), (3, 0),
(4, 0), (3, 1), (2, 2), (1, 3), (0, 4),
(0, 5), (1, 4), (2, 3), (3, 2), (4, 1), (5, 0),
(6, 0), (5, 1), (4, 2), (3, 3), (2, 4), (1, 5), (0, 6),
(0, 7), (1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1), (7, 0)
		

Crossrefs

Cf. A319572 (stripe x), A319573 (stripe y).
Cf. A319514 (shell enumeration), A319289 (shell x), A319290 (shell y).

Programs

  • Julia
    function A319571(n)
        k, r = divrem(n, 2)
        d = div(isqrt(8k+1) - 1, 2)
        s = k - div(d*(d + 1), 2)
        isodd(d) ? (s, d-s)[r+1] : (d-s, s)[r+1]
    end
    function stripe(x, y, state)
        x == 0 && !state && return x, y+1, !state
        y == 0 &&  state && return x+1, y, !state
        state && return x+1, y-1, state
        return x-1, y+1, state
    end
    function StripeEnumeration(len)
        x, y, state = 0, 0, false
        for n in 0:len
            println("$n -> ($x, $y)")
            x, y, state = stripe(x, y, state)
        end
    end
    function Pairing(x, y)
        p = isodd(x - y) ? x : y
        div((x + y)*(x + y + 1), 2) + p
    end
    StripeEnumeration(40)
    
  • Python
    from itertools import count, islice
    def A319571_gen(): # generator of terms
        for n in count(0):
            for m in range(n+1):
                 yield from (m,n-m) if n % 2 else (n-m,m)
    A319571_list = list(islice(A319571_gen(),100)) # Chai Wah Wu, May 21 2022

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.

Original entry on oeis.org

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, 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, 13, 0, 14, 0, 0, 5, 1, 4, 2, 4, 3, 3, 4, 3, 5, 3, 6, 2, 7, 2
Offset: 0

Views

Author

Peter Luschny, Feb 18 2020

Keywords

Comments

Other enumerations of N X N designed with storage allocation for extensible arrays in mind include A319514 and A319571.

Examples

			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.
		

Crossrefs

A332663 (x-coordinates), A056559 (y-coordinates).

Programs

  • 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
  • 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 *)

A319572 The x coordinates of the stripe enumeration of N X N where N = {0, 1, 2, ...}.

Original entry on oeis.org

0, 0, 1, 2, 1, 0, 0, 1, 2, 3, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 6
Offset: 0

Views

Author

Peter Luschny, Sep 23 2018

Keywords

Comments

See A319571 for comments and references.

Crossrefs

Cf. A319571 (stripe enumeration), this sequence (stripe x), A319573 (stripe y).
Cf. A319514 (shell enumeration), A319289 (shell x), A319290 (shell y).

Programs

  • Julia
    # Function stripe is defined in A319571.
    function StripeEnumerationX(len)
        x, y, state = 0, 0, false
        for n in 0:len
            print("$x, ")
            x, y, state = stripe(x, y, state)
        end
    end
    StripeEnumerationX(84)

A319573 The y coordinates of the stripe enumeration of N X N where N = {0, 1, 2, ...}.

Original entry on oeis.org

0, 1, 0, 0, 1, 2, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6
Offset: 0

Views

Author

Peter Luschny, Sep 23 2018

Keywords

Comments

See A319571 for comments and references.

Crossrefs

Cf. A319571 (stripe enumeration), A319572 (stripe x), this sequence (stripe y).
Cf. A319514 (shell enumeration), A319289 (shell x), A319290 (shell y).

Programs

  • Julia
    # Function stripe is defined in A319571.
    function StripeEnumerationY(len)
        x, y, state = 0, 0, false
        for n in 0:len
            print("$y, ")
            x, y, state = stripe(x, y, state)
        end
    end
    StripeEnumerationY(84)

A319513 The boustrophedonic Rosenberg-Strong function maps N onto N X N where N = {0, 1, 2, ...} and n -> factor(a(n)) = 2^x*3^y -> (x, y).

Original entry on oeis.org

1, 3, 6, 2, 4, 12, 36, 18, 9, 27, 54, 108, 216, 72, 24, 8, 16, 48, 144, 432, 1296, 648, 324, 162, 81, 243, 486, 972, 1944, 3888, 7776, 2592, 864, 288, 96, 32, 64, 192, 576, 1728, 5184, 15552, 46656, 23328, 11664, 5832, 2916, 1458, 729, 2187, 4374, 8748, 17496
Offset: 0

Views

Author

Peter Luschny, Sep 21 2018

Keywords

Comments

If (x, y) and (x', y') are adjacent points on the trajectory of the map then for the boustrophedonic Rosenberg-Strong function max(|x - x'|, |y - y'|) is always 1 whereas for the Rosenberg-Strong function this quantity can become arbitrarily large. In this sense the boustrophedonic variant is continuous in contrast to the original Rosenberg-Strong function.

References

  • A. L. Rosenberg, H. R. Strong, Addressing arrays by shells, IBM Technical Disclosure Bulletin, vol 14(10), 1972, p. 3026-3028.

Crossrefs

See A319514 for a non-decoded variant with interleaved x and y coordinates.

Programs

  • Julia
    function bRS(n)
        m = x = isqrt(n)
        y = n - x^2
        x <= y && ((x, y) = (2x - y, x))
        isodd(m) ? (y, x) : (x, y)
    end
    A319513(n) = ((x, y) = bRS(n); 2^x * 3^y)
    [A319513(n) for n in 0:52] |> println
  • Maple
    A319513 := proc(n) local b, r, p, m;
        b := floor(sqrt(n)); r := n - b^2;
        p := `if`(r < b, [b, r], [2*b-r, b]);
        m := `if`(p[1] > p[2], p[1], p[2]);
        `if`(irem(m,2) = 0, 2^p[1]*3^p[2], 2^p[2]*3^p[1]) end:
    seq(A319513(n), n=0..52);
  • Mathematica
    a[n_] := Module[{b, r, p1, p2, m}, b = Floor[Sqrt[n]]; r = n-b^2; {p1, p2} = If[rp2, p1, p2]; If[EvenQ[m], 2^p1 3^p2, 2^p2 3^p1]]; Table[a[n], {n, 0, 52}] (* Jean-François Alcover, Feb 14 2019, from Maple *)
Showing 1-7 of 7 results.