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.

User: Andrei Zabolotskii

Andrei Zabolotskii's wiki page.

Andrei Zabolotskii has authored 3 sequences.

A385672 Irregular triangle read by rows: T(n, k) is the number of n-step walks on the square lattice having algebraic area k; n >= 0, 0 <= k <= floor(n^2/4).

Original entry on oeis.org

1, 4, 12, 2, 40, 8, 4, 124, 42, 16, 6, 2, 416, 160, 92, 28, 16, 4, 4, 1348, 678, 362, 174, 88, 34, 22, 8, 6, 2, 4624, 2548, 1624, 756, 460, 200, 156, 56, 40, 20, 12, 4, 4, 15632, 10062, 6336, 3586, 2110, 1106, 742, 388, 278, 152, 82, 46, 34, 14, 8, 6, 2
Offset: 0

Author

Andrei Zabolotskii, Aug 04 2025

Keywords

Comments

Rows can be extended to negative k with T(n, -k) = T(n, k). Sums of such extended rows give 4^n.
The algebraic area is Integral y dx over the walk, which equals (Sum_{steps right} y) - (Sum_{steps left} y).

Examples

			The triangle begins:
     1
     4
    12,   2
    40,   8,   4
   124,  42,  16,   6,  2
   416, 160,  92,  28, 16,  4,  4
  1348, 678, 362, 174, 88, 34, 22, 8, 6, 2
   ...
T(3, 1) = 8: RUR (right, up, right), LUR, RDL, LDL, URU, URD, DLU, DLD.
		

Crossrefs

Row lengths are A033638 = A002620 + 1.
A352838 is an analog that gives the number of closed walks.

Programs

  • Python
    d = [{((0, 0), 0): 1}]
    for _ in range(10):
        nd = {}
        for key, nw in d[-1].items():
            pos, ar = key
            x, y = pos
            for key in [
                ((x+1, y), ar + y),
                ((x-1, y), ar - y),
                ((x, y+1), ar),
                ((x, y-1), ar)
                ]:
                if key in nd:
                    nd[key] += nw
                else:
                    nd[key] = nw
        d.append(nd)
    t = []
    for nd in d:
        a = [0] * (max(ar for _, ar in nd) + 1)
        for key, nw in nd.items():
            _, ar = key
            if ar >= 0:
                a[ar] += nw
        t.append(a)
    print(t)

Formula

It appears that T(2*n, n^2 - k) = 2 * A029552(k) for k < n and T(2*n+1, n^2+n - k) = 4 * A098613(k) for k < n.

A386406 Length of the preperiodic part of the decimal expansion of 1/n, including any leading zeros from the period.

Original entry on oeis.org

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

Author

Andrei Zabolotskii, Jul 20 2025

Keywords

Comments

See A114205.

Examples

			For n = 92, 1/n = 0.01(0869565217391304347826) = 0.010(8695652173913043478260), so the preperiodic part is "010" and has length a(92) = 3.
		

Crossrefs

Programs

  • Mathematica
    b[n_] := Block[{p,o}, {p,o} = RealDigits[1/n]; If[!IntegerQ[Last[p]], p = Join[Most[p],TakeWhile[Last[p],#==0&]]]; Length[p]-o];
    Table[b[n], {n,2,100}]
  • PARI
    a(n) = my(pre = max(valuation(n,2),valuation(n,5)), r = 10^pre % n); pre + if(r,logint(n\r,10)); \\ Kevin Ryde, Jul 22 2025

Formula

a(n) = p + (floor(log_10(1/f)) if f!=0), where p = A051628(n) and f = frac(10^p/n). - Kevin Ryde, Jul 22 2025

A352838 Irregular triangle read by rows: T(n, k) is the number of 2n-step closed walks on the square lattice having algebraic area k; n >= 0, 0 <= k <= floor(n^2/4).

Original entry on oeis.org

1, 4, 28, 4, 232, 72, 12, 2156, 1008, 308, 48, 8, 21944, 13160, 5540, 1560, 420, 80, 20, 240280, 168780, 87192, 33628, 11964, 3636, 1200, 264, 72, 12, 2787320, 2168544, 1291220, 610232, 262612, 101976, 40376, 13720, 4900, 1512, 420, 112, 28
Offset: 0

Author

Andrei Zabolotskii, Apr 05 2022

Keywords

Comments

Rows can be extended to negative k with T(n, -k) = T(n, k). Sums of such extended rows give A002894.
T(n, k) is the number of words of length 2n equal to z^k in the Heisenberg group, presented as , where z=[x,y]. In particular, T(n, 0) = A307468(n).

Examples

			The table begins:
       1
       4
      28,      4
     232,     72,    12
    2156,   1008,   308,    48,     8
   21944,  13160,  5540,  1560,   420,   80,   20
  240280, 168780, 87192, 33628, 11964, 3636, 1200, 264, 72, 12
     ...
T(2, 0) = 28: the 4-step walks enclosing algebraic area 0 include 16 walks of the form "some two steps, then two steps right back" and 12 walks of the form "some step, step back, a different step, step back".
T(2, 1) = 4: the 4-step walks enclosing algebraic area 1 are the walks around each of the 4 squares touching the origin in the positive direction; cf. A334756(2, 1) = 8, which also counts walks around these squares in the negative direction.
		

Crossrefs

Row lengths are A033638 = A002620 + 1.
Row n ends with 4 * A026741(n) for n > 0.
Row 16 is A178106.
A334756 counts self-avoiding walks only.

Programs

  • Mathematica
    z[0, 0, 0, 0] = 1;
    z[-1, ] = z[, -1, _] = z[, , -1, ] = z[, , , -1] = 0;
    z[m1_, m2_, l1_, l2_] := z[m1, m2, l1, l2] = Expand[z[m1, m2, l1 - 1, l2] + z[m1, m2, l1, l2 - 1] + q^(l2 - l1) z[m1 - 1, m2, l1, l2] + q^(l1 - l2) z[m1, m2 - 1, l1, l2]];
    zN[n_] := Sum[z[m, m, n/2 - m, n/2 - m], {m, 0, n/2}];
    walks[n_] := Module[{gf = zN[2 n], e}, e = Exponent[gf, q, Max]; CoefficientList[gf q^e, q][[e + 1 ;;]]];
    Table[walks[n], {n, 0, 8}]