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: Allan C. Wechsler

Allan C. Wechsler's wiki page.

Allan C. Wechsler has authored 81 sequences. Here are the ten most recent ones:

A383447 Number of "peerless" trees on n nodes.

Original entry on oeis.org

1, 0, 1, 1, 2, 3, 6, 9, 19, 33, 67, 130, 270, 547, 1165, 2456, 5314, 11521, 25357, 56022, 125067, 280471, 633490, 1437340, 3278912, 7510503, 17277697, 39890262, 92427559, 214835923, 500879602, 1171013350, 2744946654, 6450077870
Offset: 1

Author

N. J. A. Sloane, May 01 2025, based on postings to the SeqFan Mailing List in April and May 2025 by Victor S. Miller, Allan C. Wechsler, Brendan McKay, and others

Keywords

Comments

A "peerless" tree is an unlabeled, unrooted tree (as in A000055) with the property that if two nodes are joined by an edge then these nodes have different degrees.
Victor S. Miller reports that this sequence was first proposed on Project Euler.
Comment from Brendan McKay, May 01 2025 (Start)
The enumeration could be extended by the following argument.
If the tree has a unique centroid (not center!) then removing the centroid gives rooted subtrees of size less than n/2. If there are two centroids, they are adjacent and removing that edge gives two rooted subtrees with exactly n/2 vertices.
Start by making all rooted trees up to n/2 vertices which have no adjacent vertices of the same degree, not counting adjacencies of the root. Then classify them according to which degrees the root can be increased to without violating this condition for edges adjacent to the root.
With this information the counts for n vertices can be reconstructed. In this way getting up past 60 vertices should be possible. (End)
This sequence forms the left-most column of A383448.

Crossrefs

Extensions

a(1)-a(8) were computed by Allan C. Wechsler, Apr 30 2025, and a(9)-a(34) by Brendan McKay, May 02 2025.

A383470 Numbers k which are divisible by the number of squares mod k.

Original entry on oeis.org

1, 2, 4, 12, 16, 24, 48, 60, 72, 112, 144, 168, 192, 224, 240, 360, 528, 576, 672, 720, 792, 1188, 1344, 1456, 2016, 2184, 2376, 2448, 2880, 3360, 4032, 4560, 4752, 5940, 6336, 6840, 7392, 8448, 8832, 10080, 11880, 13200, 13248, 15456, 16632, 17472, 19008, 19800
Offset: 1

Author

Allan C. Wechsler, Apr 27 2025

Keywords

Comments

The number of quadratic residues modulo n is A000224; this is the list of numbers k for which k is an integer multiple of A000224(k).
Finding numbers of this sort is fairly easy, because A000224(k) is multiplicative, but enumerating them exhaustively is more of a challenge. Other larger examples are 2004480, 71513280 (found by Robert Israel, the smallest example divisible by 89), and 1517336658746346757423104.

Examples

			224 has exactly 28 quadratic residues, that is, A000224(224) = 28. And 224 is 8 * 28, so 224 is an element of this sequence. But 225 has 44 quadratic residues, and 225 is not a multiple of 44, so 225 is not an element of this sequence.
		

Crossrefs

Cf. A000224.

Programs

  • Mathematica
    f[p_, e_] := Floor[p^(e + 1)/(2*p + 2)] + 1; f[2, e_] := Floor[2^e/6] + 2; q[1] = True; q[n_] := Divisible[n, Times @@ f @@@ FactorInteger[n]]; Select[Range[20000], q] (* Amiram Eldar, Apr 27 2025 *)
  • Python
    # Without benefit of sympy:
    from math import prod
    def factor(n):
      result = []
      for d in two_and_odds():
        if n == 1:
          return result
        if d > n // d:
          return result + [(n, 1)]
        e = 0
        while n % d == 0:
          e += 1
          n = n // d
        if e > 0:
          result += [(d, e)]
    def two_and_odds():
      yield 2
      k = 3
      while True:
        yield k
        k += 2
    # From Chai Wah Wu at A000224
    def s(n): return prod((p**(e+1)//((p+1)*(q:=1+(p==2)))>>1)+q for p, e in factor(n))
    def main(n):
        count = 1
        for i in range(1,n):
            if i%s(i) == 0:
                print(f"{count} {i}")
                count += 1

A381019 a(n) is the smallest positive integer not yet in the sequence such that a(n) is relatively prime to a(n-i) for all 1 <= i <= min(a(n), n-1).

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 4, 13, 17, 19, 23, 29, 9, 31, 37, 8, 41, 43, 47, 53, 59, 61, 6, 67, 71, 73, 79, 83, 89, 25, 97, 101, 103, 107, 109, 12, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 10, 173, 179, 181, 191, 193, 197, 199, 49, 211, 223, 227, 229, 233
Offset: 1

Author

Ali Sada and Allan C. Wechsler, Feb 12 2025

Keywords

Comments

Theorem (Russ Cox, Feb 14-16, 2025): Every positive number will eventually appear. For proof see link.
Jinyuan Wang (Feb 16, 2025) has informed us that he also proved that every number appears.

Examples

			After a(2)=2, the next term that shares a common factor with 2 is a(7)=4, which is permitted since the difference 7-2 = 5 is greater than 4.
		

Crossrefs

A381167 is a different but closely related sequence.

Programs

  • Maple
    N:= 1000: # for terms before the first term > N
    Cands:= [$2..N]: R:= [1]: x:= 1:
    for n from 2 do
      found:= false;
      for j from 1 to N - n do
        if andmap(t -> igcd(t, Cands[j]) = 1, [seq(R[n-i],i=1 .. min(Cands[j],n-1))]) then
          found:= true; x:= Cands[j]; R:= [op(R),x]; Cands:= subsop(j=NULL,Cands); break
        fi od:
      if not found then break fi
    od:
    R; # Robert Israel, Feb 14 2025
  • Mathematica
    nn = 120; c[_] = False; u = v = 2; a[1] = 1;
    Do[k = u;
      While[Or[c[k],
        ! CoprimeQ[k, Product[a[h], {h, n - Min[k, n - 1], n - 1}] ] ],
        If[k > n - 1, k = v, k++]];
      Set[{a[n], c[k]}, {k, True}];
      If[k == u, While[c[u], u++]];
      If[k == v, While[Or[c[v], CompositeQ[v]], v++]], {n, 2, nn}];
    Array[a, nn] (* Michael De Vlieger, Feb 14 2025 *)
  • Python
    # see link for faster version
    from math import gcd
    from itertools import count, islice
    def agen(): # generator of terms
        alst, aset, an, m = [1], {1}, 1, 2
        for n in count(2):
            yield an
            an = next(k for k in count(m) if k not in aset and all(gcd(alst[-j], k) == 1 for j in range(1, min(k, n-1)+1)))
            alst.append(an)
            aset.add(an)
            while m in aset: m += 1
    print(list(islice(agen(), 61))) # Michael S. Branicky, Feb 13 2025

Extensions

More terms from Michael S. Branicky, Feb 13 2025

A377279 Number of fixed points of f(k) = floor(k^2 / n) mod n^2.

Original entry on oeis.org

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

Author

Allan C. Wechsler, Oct 22 2024

Keywords

Comments

The classic base-B "middle square" technique for generating pseudorandom numbers is to square a seed less than B^2, express it in base B, and extract the middle two digits for the next iterate.
This is a very bad technique: it has many short trajectories ending in fixed points or short cycles. This sequence records the number of fixed points.

Examples

			For n = 7, 30^2 = 900. Integer-divide this by 7 to get 128, which is 30 mod 49 (7^2). So 30 is a fixed point. Two other fixed points are 0 and 7, so A(7) = 3.
		

Programs

  • Python
    def f(b):
        count = 0
        for n in range(b*b):
            val = ((n*n) // b) % (b*b)
            if n == val:
                count += 1
        return count

A368570 Numbers k such that both k and k+1 are the sums of consecutive squares.

Original entry on oeis.org

0, 4, 13, 29, 49, 54, 85, 90, 139, 144, 203, 255, 284, 365, 384, 505, 509, 649, 676, 728, 729, 818, 924, 960, 1013, 1014, 1201, 1210, 1225, 1239, 1454, 1495, 1784, 1854, 2108, 2214, 2469, 2665, 2779, 2813, 2814, 2869, 3025, 3135, 3309, 3310, 3794, 4230, 4323, 4324, 4705
Offset: 1

Author

Allan C. Wechsler, Dec 30 2023

Keywords

Comments

A subsequence of A034705, identifying the lower of each pair of consecutive integers belonging to that sequence.
Similarly, two consecutive integers in this sequence, a(n+1) = a(n)+1, such as 1013 and 1014, or 3309 and 3310, correspond to three consecutive integers in A034705, and so on. - M. F. Hasler, Jan 02 2024

Examples

			85 = 6^2 + 7^2, and 86 = 3^2 + 4^2 + 5^2 + 6^2, so 85 is in the list.
		

Crossrefs

Cf. A034705.

Programs

  • Mathematica
    a[n_] := Module[{v, r = {}, s = 1, t, ul = 100, pr = 1}, While[Length[r] < n, v = ConstantArray[0, ul + 1]; Do[t = 0; Do[t += j^2; If[t <= ul + 1, v[[t]] = 1, Break[]], {j, i, 1, -1}], {i, 1, Sqrt[ul + 1]}]; Do[If[v[[i]] == 1, s++; If[s >= 2 && Not[MemberQ[r, i - 1]], AppendTo[r, i - 1]], s = 0], {i, pr, ul + 1}]; pr = ul + 1; ul *= 2; ]; Take[r, n]];
    a[49] (* Robert P. P. McKone, Dec 30 2023 *)
  • PARI
    \\ See PARI link
    
  • PARI
    is_A368570(n)=is_A034705(n)&&is_A034705(n+1) \\ M. F. Hasler, Jan 02 2024
    
  • Python
    import heapq
    from itertools import islice
    def agen(): # generator of terms
        m = 0; h = [(m, 0, 0)]; nextcount = 1; v1 = -2
        while True:
            (v, s, l) = heapq.heappop(h)
            if v != v1:
                if v1 + 1 == v: yield v1
                v1 = v
            if v >= m:
                m += nextcount*nextcount
                heapq.heappush(h, (m, 1, nextcount))
                nextcount += 1
            v -= s*s; s += 1; l += 1; v += l*l
            heapq.heappush(h, (v, s, l))
    print(list(islice(agen(), 51))) # Michael S. Branicky, Jan 01 2024

Extensions

More terms from Jon E. Schoenfield, 30 Dec 2023

A366443 Number of free polyominoes of site-perimeter n.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 1, 5, 5, 23, 46, 187, 552, 2145, 7818
Offset: 1

Author

John Mason from an idea of Allan C. Wechsler, Oct 10 2023

Keywords

Comments

This sequence counts free connected (via common edges) polyominoes with given site-perimeter. The site-perimeter of a polyomino is the number of cells that are adjacent to it (via common edges). This sequence allows holes of any kind.

Examples

			a(4) = a(6) = a(7) = 1 as the monomino, domino and L-shaped tromino are the only polyominoes with site perimeter 4, 6 and 7 respectively.
a(5) = 0 as no polyomino has a site-perimeter of 5.
a(8) = 5 as the straight tromino, square tetromino, T-tetromino, S-tetromino and cross pentomino are the only polyominoes with site perimeter 8. See link "Examples".
		

Crossrefs

Cf. A000105 (free polyominoes), A001971 (the maximum size of a polyomino with site-perimeter n is given by A001971(n-2)), A057730 (perimeter instead of site-perimeter), A216820 (fixed version of current sequence).
Column sums of A338211 (without the column for 0-celled polyominoes).

Extensions

a(15) corrected by Sean A. Irvine, Apr 13 2025

A363100 Fractal sequence which is left unchanged by interleaving it with the natural numbers, in such a way that each term k of the sequence is followed by the next k not-yet-seen natural numbers.

Original entry on oeis.org

1, 2, 2, 3, 4, 2, 5, 6, 3, 7, 8, 9, 4, 10, 11, 12, 13, 2, 14, 15, 5, 16, 17, 18, 19, 20, 6, 21, 22, 23, 24, 25, 26, 3, 27, 28, 29, 7, 30, 31, 32, 33, 34, 35, 36, 8, 37, 38, 39, 40, 41, 42, 43, 44, 9, 45, 46, 47, 48, 49, 50, 51, 52, 53, 4, 54
Offset: 1

Author

Allan C. Wechsler, May 20 2023

Keywords

Comments

a(1) = 1. Each term a(n) = k is followed by the k smallest so-far-unseen natural numbers. Invented by Eric Angelini. Another way to say it (Angelini's formulation) is that when subjected to an erasure transformation, the k terms after a(n) = k are deleted, the original sequence is recovered; and if otherwise unconstrained, the natural numbers are introduced as soon as possible.

A361338 Number of different single-digit numbers that can be reached from n by any permissible sequence of split-and-multiply operations.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3
Offset: 0

Author

N. J. A. Sloane, Apr 04 2023, following emails from Eric Angelini and Allan C. Wechsler

Keywords

Comments

We always split an integer into two integers, then multiply them (and iterate). For example, 2023 can be split into 20 and 23 (producing 20*23 = 460), or split into 202 and 3 (producing 202*3 = 606). The split 2 and 023 is forbidden, as 023 is not an integer (but 460 can be split into 46 and 0 as 0 is an integer).
The sequence is the number of different single-digit numbers that can be obtained from n by any sequence of splits and multiplications.
a(n) can take on any value from 1 to 10, inclusive. There are many obvious questions. Clearly (by induction), a(10*k) = 1, but are there arbitrarily large n with a(n) = 1 that are not multiples of 10? If not, what is the largest such n? - Allan C. Wechsler, Apr 04 2023
All numbers of the form m = (c)(0^i)(d) where c in 1..9, d in 1..9, i > 0 and juxtaposition/exponentiation are concatenation and repeated concatenation, resp., have a(m) = 1 since they lead only to 0 or multiples of 10. - Michael S. Branicky, Apr 07 2023

Examples

			From 110 we can reach 11*0 = 0, or 1*10 = 10 -> 1*0 = 0, so we can only reach 0, and so a(110) = 1.
From 112 we can reach 11*2 = 22 -> 2*2 = 4, or 1*12 = 12 -> 1*2 = 2, so a(112) = 2.
		

Crossrefs

See A361337 for the numbers that reach 0, and A361339 for the smallest k such that a(k) = n.
See also A361340-A361349.

Programs

  • Mathematica
    Array[Count[Union@ Flatten[#], _?(# < 10 &)] &@
       NestWhileList[Flatten@ Map[
           Function[w,
              Array[If[And[#[[-1, 1]] == 0, Length[#[[-1]]] > 1], Nothing,
                    Times @@ Map[FromDigits, #]] &@ TakeDrop[w, #] &,
               Length[w] - 1]][IntegerDigits[#]] &, #] &, {#},
    Length[#] > 0 &] &, 140, 0] (* Michael De Vlieger, Apr 04 2023 *)
    (* Generate 100000 terms from linked image above *)
    Flatten@ Array[Map[Total, Transpose@ ImageData[ColorNegate@ Import["https://oeis.org/A361338/a361338_2.png", "PNG"], "Bit"][[10 # + 1 ;; 10 # + 10, 1 ;; 1000]]] &, 100, 0] (* Michael De Vlieger, Apr 06 2023 *)
  • PARI
    A361338(n, set=0)=if(!set, #A361338(n, 1), n<20, [n%10], Set(concat([A361338(vecprod(divrem(n,10^p)), 1)| p<-[1..logint(n,10)],p==1||n\10^(p-1)%10]))) \\ M. F. Hasler, Apr 08 2023
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def f(n):
        if n < 10: return {n}
        s = str(n)
        return {e for i in range(1, len(s)) if s[i]!="0" or i==len(s)-1 for e in f(int(s[:i])*int(s[i:]))}
    def A361338(n):
        return len(f(n))
    print([A361338(n) for n in range(140)]) # Michael S. Branicky, Apr 04 2023
    

Formula

a(n) = 1 for all n < 112. - M. F. Hasler, Apr 08 2023

Extensions

More than the usual number of terms are displayed in order to reach the first 3.

A361754 The number of free polyominoes of area n that fill their minimal enclosing circle (MEC). A polyomino "fills" its minimal enclosing circle if no square may be added to it that doesn't have some point outside of the circle.

Original entry on oeis.org

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

Author

John Mason and Allan C. Wechsler, Mar 23 2023

Keywords

Examples

			See link "Illustrations".
a(3)=0 because (i) the minimal enclosing circle of the straight tromino also contains the cross pentomino, and (ii) the MEC of the L-shaped tromino also contains the square tetromino.
		

Crossrefs

Cf. A147680.

A360926 Smallest number of moves needed to win Integer Lunar Lander with a starting position of (n,n).

Original entry on oeis.org

0, 3, 6, 8, 11, 13, 16, 18, 20, 23, 25, 28, 30, 33, 35, 37, 40, 42, 45, 47, 49, 52, 54, 57, 59, 62, 64, 66, 69, 71, 74, 76, 78, 81, 83, 86, 88, 91, 93, 95, 98, 100, 103, 105, 107, 110, 112, 115, 117, 119, 122, 124, 127, 129, 132, 134, 136, 139, 141, 144, 146
Offset: 0

Author

Allan C. Wechsler, Feb 25 2023

Keywords

Comments

See A360923 for the rules of Integer Lunar Lander.
Data from Tom Karzes.
The conjectured formula for A360923 implies a formula for a(n). - N. J. A. Sloane, Feb 26 2023

Examples

			From starting position (3,3), an 8-move solution is (2,5), (1,6), (0,6), (-1,5), (-2,3), (-2,1), (-1,0), (0,0). There is no shorter solution, so a(3) = 8.
		

Crossrefs

Main diagonal of table A360923. Cf. A360924, A360925.

Extensions

More terms from Rémy Sigrist, Feb 26 2023