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: Orson R. L. Peters

Orson R. L. Peters's wiki page.

Orson R. L. Peters has authored 4 sequences.

A326955 Denominator of the expected number of distinct squares visited by a knight's random walk on an infinite chessboard after n steps.

Original entry on oeis.org

1, 1, 8, 4, 512, 256, 16384, 8192, 2097152, 1048576, 16777216, 8388608, 4294967296, 2147483648, 68719476736, 34359738368, 35184372088832, 17592186044416, 281474976710656, 140737488355328, 18014398509481984
Offset: 0

Author

Orson R. L. Peters, Aug 08 2019

Keywords

Comments

The starting square is always considered part of the walk.

Examples

			a(0) = 1 (from 1/1), we count the starting square.
a(1) = 1 (from 2/1), each possible first step is unique.
a(2) = 8 (from 23/8), as for each possible first step 1/8th of the second steps go back to a previous square, thus the expected distinct squares visited is 2 + 7/8 = 23/8.
		

Crossrefs

See A326954 for numerators. Cf. A309221.

Programs

  • Python
    from itertools import product
    from fractions import Fraction
    def walk(steps):
        s = [(0, 0)]
        for dx, dy in steps:
            s.append((s[-1][0] + dx, s[-1][1] + dy))
        return s
    moves = [(1, 2), (1, -2), (-1, 2), (-1, -2),
             (2, 1), (2, -1), (-2, 1), (-2, -1)]
    A326955 = lambda n: Fraction(
            sum(len(set(walk(steps)))
                for steps in product(moves, repeat=n)),
            8**n
        ).denominator

A326954 Numerator of the expected number of distinct squares visited by a knight's random walk on an infinite chessboard after n steps.

Original entry on oeis.org

1, 2, 23, 15, 2355, 1395, 102971, 58331, 16664147, 9197779, 160882675, 87300443, 48181451689, 25832538281, 881993826001, 468673213505, 508090131646771, 268129446332211, 4514206380211785, 2369170809554097, 317528931045821675
Offset: 0

Author

Orson R. L. Peters, Aug 08 2019

Keywords

Comments

The starting square is always considered part of the walk.

Examples

			a(0) = 1 (from 1/1), we count the starting square.
a(1) = 2 (from 2/1), each possible first step is unique.
a(2) = 23 (from 23/8), as for each possible first step 1/8th of the second steps go back to a previous square, thus the expected distinct squares visited is 2 + 7/8 = 23/8.
		

Crossrefs

See A326955 for denominators. Cf. A309221.

Programs

  • Python
    from itertools import product
    from fractions import Fraction
    def walk(steps):
        s = [(0, 0)]
        for dx, dy in steps:
            s.append((s[-1][0] + dx, s[-1][1] + dy))
        return s
    moves = [(1, 2), (1, -2), (-1, 2), (-1, -2),
             (2, 1), (2, -1), (-2, 1), (-2, -1)]
    A326954 = lambda n: Fraction(
            sum(len(set(walk(steps)))
                for steps in product(moves, repeat=n)),
            8**n
        ).numerator

A293722 Number of distinct nonempty subsequences of the binary expansion of n.

Original entry on oeis.org

1, 1, 3, 2, 5, 6, 5, 3, 7, 10, 11, 9, 8, 9, 7, 4, 9, 14, 17, 15, 16, 19, 17, 12, 11, 15, 16, 13, 11, 12, 9, 5, 11, 18, 23, 21, 24, 29, 27, 20, 21, 29, 32, 27, 25, 28, 23, 15, 14, 21, 25, 22, 23, 27, 24, 17, 15, 20, 21, 17, 14, 15, 11, 6, 13, 22, 29, 27, 32, 39, 37
Offset: 0

Author

Orson R. L. Peters, Oct 15 2017

Keywords

Comments

The subsequence does not need to consist of adjacent terms.

Examples

			a(4) = 5 because 4 = 100_2, and the distinct subsequences of 100 are 0, 1, 00, 10, 100.
Similarly a(7) = 3, because 7 = 111_2, and 111 has only three distinct subsequences: 1, 11, 111.
a(9) = 10: 9 = 1001_2, and we get 0, 1, 00, 01, 10, 11, 001, 100, 101, 1001.
		

Crossrefs

Cf. A141297.
If the empty subsequence is also counted, we get A293170.

Programs

  • Python
    def a(n):
        if n == 0: return 1
        r, l = 1, [0, 0]
        while n:
            r, l[n%2] = 2*r - l[n%2], r
            n >>= 1
        return r - 1

Formula

a(2^n) = 2n + 1.
a(2^n-1) = n if n>0.
a(n) = A293170(n) - 1. - Andrew Howroyd, Apr 27 2020

Extensions

Terms a(50) and beyond from Andrew Howroyd, Apr 27 2020

A281795 Number of unit squares (partially) covered by a disk of radius n centered at the origin.

Original entry on oeis.org

0, 4, 16, 36, 60, 88, 132, 172, 224, 284, 344, 416, 484, 568, 664, 756, 856, 956, 1076, 1200, 1324, 1452, 1600, 1740, 1884, 2040, 2212, 2392, 2560, 2732, 2928, 3120, 3332, 3536, 3748, 3980, 4192, 4428, 4660, 4920, 5172, 5412, 5688, 5956, 6248, 6528, 6804, 7104, 7400, 7716
Offset: 0

Author

Orson R. L. Peters, Jan 30 2017

Keywords

Comments

Touching a unit square does not count as covering. E.g., the disk with radius 5 does not cover the unit square with (3, 4) as bottom-left corner.

Examples

			a(4) = 4 * 15 = 60 because in the positive quadrant 15 unit squares are covered and the problem is symmetrical. In the bounding box of the circle only the unit squares in the corners are not (partially) covered, so a(4) = 8*8 - 4 = 60.
		

Crossrefs

Programs

  • Maple
    N:= 100:  # for a(0)..a(N)
    V:=Array(0..N):
    for i from 0 to N do
      for j from 0 to i do
        r:= sqrt(i^2 + j^2);
        if r::integer then r:= r+1 else r:= ceil(r) fi;
        if r > N then break fi;
        if i=j then m:= 4 else m:= 8 fi;
        V[r..N]:= V[r..N] +~ m;
    od od:
    convert(V,list); # Robert Israel, Feb 21 2025
  • Mathematica
    A281795[n_] := 4*Sum[Ceiling[Sqrt[n^2 - k^2]], {k, 0, n-1}];
    Array[A281795, 100, 0] (* Paolo Xausa, Feb 21 2025 *)
  • Octave
    a = @(n) 4*sum(ceil(sqrt(n.^2-(0:n-1).^2))); % Luis Mendo, Aug 09 2021
  • Python
    a = lambda n: sum(4 for x in range(n) for y in range(n)
                        if x*x + y*y < n*n)
    

Formula

a(n) = 4*A001182(n) + A242118(n). - Andrey Zabolotskiy, Jan 30 2017
a(n) = Sum_{k=0..n-1} 4*ceiling(sqrt(n^2-k^2)). - Luis Mendo, Aug 09 2021