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: SiYang Hu

SiYang Hu's wiki page.

SiYang Hu has authored 5 sequences.

A384694 Sum of the number of cells alive after 2 generations of Conway's game of life for initial 1 X n cells taken in all 2^n combinations of alive or dead.

Original entry on oeis.org

0, 0, 3, 12, 35, 92, 228, 544, 1264, 2880, 6464, 14336, 31488, 68608, 148480, 319488, 684032, 1458176, 3096576, 6553600, 13828096, 29097984, 61079552, 127926272, 267386880, 557842432, 1161822208, 2415919104, 5016387584, 10401873920, 21541945344, 44560285696, 92073361408, 190052302848, 391915765760
Offset: 0

Author

SiYang Hu, Jun 07 2025

Keywords

Examples

			For n = 5, there are 5 ways for the cells to evolve into a blinker: ..OOO, O.OOO, .OOO., OOO.., OOO.O; 4 ways for the cells to evolve into a beehive predecessor and then a beehive: OOOO., .OOOO; 1 way for it to evolve into 8 cells: OOOOO, so a(5) = 3 * 5 + 6 * 2 + 8 * 1 = 35.
		

Crossrefs

Cf. A167667 (after one generation).

Formula

G.f.: x^2*(3 - x^2)/(1 - 4*x + 4*x^2).
a(n) = 2^(n - 5) * (11*n - 20).
E.g.f.: (9 - 4*x - 2*x^2 + exp(2*x)*(22*x - 9))/16. - Stefano Spezia, Jun 07 2025

A384308 a(1) = 3; for n > 1, a(n) is the smallest number that has not appeared before and has the same set of prime divisors as a(n-1) + 1.

Original entry on oeis.org

3, 2, 9, 10, 11, 6, 7, 4, 5, 12, 13, 14, 15, 8, 27, 28, 29, 30, 31, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 81, 82, 83, 42, 43, 44, 45, 46, 47, 36, 37, 38, 39, 40, 41, 84, 85, 86, 87, 88, 89, 60, 61, 62, 63, 32, 33, 34, 35, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 90, 91, 92, 93, 94, 95, 72, 73, 74, 75
Offset: 1

Author

SiYang Hu, May 25 2025

Keywords

Comments

Theorem 1: {a(n)} is a permutation of the positive integers greater than 1.
Proof: Suppose the smallest positive integer greater than 1 that does not appear in this sequence is m, whose set of prime divisors is {p1, p2, ..., pk}. Since there are infinitely many numbers with this set of prime divisors, we know that either all of them appear or none of them appear. Since m is the smallest among them, we know that m = p1*p2*...*pk. Therefore, p1*p2*...*pk - 1 does not appear, a contradiction, implying that all integers greater than one appear in {a(n)}. Since there are no repetitions by the definition, we have proven that {a(n)} is a permutation of the positive integers greater than 1.
From Yifan Xie, May 26 2025: (Start)
Theorem 2: The parity of a(n) is the same as the parity of n.
Proof: Since a(1) is odd, we only need to prove that an odd term is immediately followed by an even term, and an even term is immediately followed by an odd term. If a(n-1) is odd, the set of prime divisors of a(n-1) + 1 contains 2, so a(n) is even; If a(n-1) and a(n) are both even, the set of prime divisors of a(n-1) + 1 does not contain 2, so a(n)/2 is a smaller candidate for a(n), a contradiction. (End)

Examples

			For a(5) = 11, 11 + 1 = 12, its set of prime divisors is {2, 3}. The smallest number with the same set of prime divisors that has not appeared before is 6, so a(6) = 6.
		

Crossrefs

Similar to A064413 and A257218.

Programs

  • Maple
    N:= 1000:# for terms before the first term > N
    for i from 2 to N do
      S:= numtheory:-factorset(i);
      if assigned(V[S]) then V[S]:= V[S] union {i}
      else V[S]:= {i}
      fi
    od:
    R:= 3: r:= 3: V[{3}]:= V[{3}] minus {3}:
    while r < N do
      S:= numtheory:-factorset(r+1);
      if V[S] = {} then break fi;
      r:= min(V[S]);
      V[S]:= V[S] minus {r};
      R:= R, r;
    od:
    R; # Robert Israel, May 25 2025
  • Mathematica
    s={3};Do[i=2;While[MemberQ[s,i]||First/@FactorInteger[i]!=First/@FactorInteger[s[[-1]]+1],i++];AppendTo[s,i],{n,2,81}];s (* James C. McMahon, Jun 04 2025 *)
  • Python
    import heapq
    from math import prod
    from sympy import factorint
    from itertools import islice
    def bgen(pset): # generator of terms with set of prime divisors = pset
        h = [prod(pset)]
        while True:
            v = heapq.heappop(h)
            yield v
            for p in pset:
                heapq.heappush(h, v*p)
    def agen(): # generator of terms
        an, aset = 3, set()
        while True:
            yield an
            aset.add(an)
            an = next(m for m in bgen(set(factorint(an+1))) if m not in aset)
    print(list(islice(agen(), 81))) # Michael S. Branicky, May 25 2025

A383766 a(n) is the number of numbers k (0 <= k < n) such that there exist solutions of x^3 + x == y^2 + 1 == k (mod n).

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 3, 1, 4, 2, 3, 2, 6, 3, 4, 2, 5, 4, 7, 2, 6, 3, 8, 2, 10, 6, 11, 3, 12, 4, 11, 4, 6, 5, 6, 4, 13, 7, 12, 2, 11, 6, 16, 3, 8, 8, 13, 4, 21, 10, 10, 6, 17, 11, 6, 3, 14, 12, 18, 4, 20, 11, 12, 8, 12, 6, 27, 5, 16, 6, 26, 4, 27, 13, 20, 7, 9, 12, 26, 4, 31, 11, 25
Offset: 1

Author

SiYang Hu, May 09 2025

Keywords

Examples

			a(7) = 3: k can be 2, 3, 5, for example, when k = 3, x = 2, and y = 4, the equation is satisfied.
		

Programs

  • Mathematica
    A383766 = Table[Count[Range[0, n - 1], k_ /; Length[Solve[{x^3 + x == k, y^2 + 1 == k}, {x, y}]] > 0], {n, 1, 50}];

Formula

If 8 does not divide n, a(2n) = a(n).
If 8 divides n, a(2n) = 2*a(n).

A383968 Number of distinct subsets S of [1..n] such that for all 1 <= k <= n, there exists two elements x,y in S (not necessarily distinct) such that x+y = 2k.

Original entry on oeis.org

1, 1, 2, 3, 5, 9, 17, 30, 58, 107, 205, 392, 768, 1466, 2883, 5597, 11038, 21572, 42675, 83711, 166371, 327893, 651199, 1288480, 2564032, 5082878, 10127472, 20115845, 40104636, 79781149, 159174500, 316962113, 632716744, 1261189166, 2518287361, 5023170116, 10034132101, 20025033970
Offset: 1

Author

SiYang Hu, May 16 2025

Keywords

Comments

Every subset S of [1..n] must have 1 and n to get 2 and 2*n. For odd n we therefore have 1+n which we need as well. If S is no such subset then no subset S' of S must be tested. - David A. Corneth, May 22 2025

Examples

			For n = 5, there are 5 sets S that satisfy the said conditions: {1, 2, 3, 4, 5}, {1, 2, 3, 5}, {1, 2, 4, 5}, {1, 3, 4, 5} and {1, 3, 5}.
		

Programs

  • Python
    def a(n):
        if n == 1: return 1
        c,t = 0, set(k << 1 for k in range(1, n+1))
        for i in range(1 << (n-2), 1 << n):
            s = [j+1 for j in range(n) if (i >> j) & 1]
            if s[0] == 1 and s[-1] == n:
                ss = set(x + y for x in s for y in s if x & 1 == y & 1)
                if t.issubset(ss): c += 1
        return c # DarĂ­o Clavijo, May 23 2025

Extensions

a(23)-a(38) from Sean A. Irvine, May 21 2025

A381975 Number of ways for n competitors to rank in a competition in which each match has 4 possible outcomes in which each competitor gains 0, 1, 2 or 3 points.

Original entry on oeis.org

1, 1, 2, 9, 58, 459, 4370, 48999, 632884, 9254473, 151155362, 2727862751
Offset: 0

Author

SiYang Hu, May 06 2025

Keywords

Comments

Also, the number of maps f:{1, 2, ..., n} -> {1, 2, ..., n} such that f(f(f(x))) >= x for all 1 <= x <= n.
When this definition is changed to f(f(x)), then the result would be the Fubini numbers (A000670).

Crossrefs

Programs

  • Haskell
    validMappings :: Int -> Int
    validMappings n = validMappingsDFS n [0] 1 where
      checkCondition f = all (\x -> f !! (f !! (f !! (x-1)) - 1) - 1 >= x) [1..n]
      validMappingsDFS n f x
        | x > n = if checkCondition f then 1 else 0
        | otherwise = sum [validMappingsDFS n (take (x-1) f ++ [i] ++ drop x f) (x+1) | i <- [1..n]]
  • Mathematica
    CheckCondition[f_, n_] := AllTrue[Range[n], (f[[f[[f[[#]]]]]] >= # &)]
    validMappingsDFS[n_, f_, x_] := Module[{i, f2, count},
      If[x > n,
        If[CheckCondition[f, n], 1, 0],
        count = 0;
        For[i = 1, i <= n, i++,
          f2 = f; f2[[x]] = i;  (* Assign mapping for f[x] *)
          count += validMappingsDFS[n, f2, x + 1];  (* Explore further *)
        ];
        count
      ]
    ]
    A381975[n_] := validMappingsDFS[n, ConstantArray[0, n], 1]
    Table[A381975[n], {n, 0, 6}]
  • Python
    def validMappings(n):
        def checkCondition(f, n):
            return all(f[f[f[x]]] >= x for x in range(1, n+1))
        def validMappingsDFS(n, f, x):
            if x > n:
                return 1 if checkCondition(f, n) else 0
            return sum(validMappingsDFS(n, f[:x] + [i] + f[x+1:], x+1) for i in range(1, n+1))
        return validMappingsDFS(n, [0] * (n+1), 1)
    
  • R
    validMappings <- function(n) {
      checkCondition <- function(f, n) all(sapply(1:n, function(x) f[f[f[x]]] >= x))
      validMappingsDFS <- function(n, f, x) {
        if (x > n) return(ifelse(checkCondition(f, n), 1, 0))
        sum(sapply(1:n, function(i) { f[x] <- i; validMappingsDFS(n, f, x + 1) }))
      }
      validMappingsDFS(n, rep(0, n), 1)
    }
    

Extensions

a(11) from Sean A. Irvine, May 13 2025