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: Bence Bernáth

Bence Bernáth's wiki page.

Bence Bernáth has authored 14 sequences. Here are the ten most recent ones:

A385713 Numbers w + x + y + z where (w,x,y,z) are nonnegative solutions to the Diophantine equation w^2 + x^2 + y^2 + z^2 = w*x*y*z.

Original entry on oeis.org

0, 8, 12, 32, 108, 292, 392, 1452, 3392, 3712, 5408, 11808, 20172, 34872, 40332, 50572, 75272, 162212, 280908, 480512, 518252, 595052, 700352, 1048352, 1639308, 3912492, 4599172, 4911172, 5725732, 6049292, 6508932, 7132608, 8279808, 9739812
Offset: 1

Author

Bence Bernáth, Jul 07 2025

Keywords

Comments

The trivial sum with x=y=z=w=0 is included. The solutions are generated by the Vieta jumping discussed in the Numberphile video. The algorithm finds all the quadruplet solutions within the radius of a 4D sphere. Then the quadruplets are sorted based on their sum in increasing order.

Examples

			8 is a term because (w,x,y,z) = (2,2,2,2) is the first nontrivial solution.
12 is a term because (2,2,2,6) is a solution.
		

Crossrefs

Programs

  • Python
    import math
    def is_perfect_square(n):
        return (math.isqrt(n)) ** 2 == n
    def generate_all_solutions(radius):
        solutions = set()
        visited = set()
        # Initial known solution
        seed = (2, 2, 2, 2)
        queue = [seed]
        solutions.add(seed)
        while queue:
            quad = queue.pop(0)
            for ii in range(4):
                # Cyclically rotate variables: solve for the ii-th one
                rotated = list(quad[ii:] + quad[:ii])
                x, y, z, w = rotated
                # Use Vieta's formula: x^2 - (yzw)x + (y² + z² + w²) = 0
                product = y * z * w
                sumsq = y**2 + z**2 + w**2
                D = product**2 - 4 * sumsq
                if D < 0 or not is_perfect_square(D):
                    continue
                sqrt_D = (math.isqrt(D))
                for sign in [+1, -1]:
                    x_new = (product + sign * sqrt_D)
                    if x_new % 2 != 0:
                        continue
                    x_new //= 2
                    if not (0 < x_new < radius):
                        continue
                    new_quad = [x_new, y, z, w]
                    if any(val >= radius for val in new_quad):
                        continue
                    new_quad_sorted = tuple(sorted(new_quad))
                    if new_quad_sorted not in visited:
                        solutions.add(new_quad_sorted)
                        queue.append(tuple(new_quad))
                        visited.add(new_quad_sorted)
        # Return solutions sorted by sum of elements
        return sorted([list(sol) for sol in solutions], key=lambda tup: sum(tup))
    print([sum(sol) for sol in generate_all_solutions(10000000)])

A380462 a(n) is the number of positive solutions to the Diophantine equation w^2 + x^2 + y^2 + z^2 = w*x*y*z such that x,y,z,w < e^n.

Original entry on oeis.org

1, 2, 2, 3, 4, 6, 6, 7, 10, 12, 16, 17, 18, 23, 25, 32, 35, 39, 43, 47, 55, 60, 64, 73, 76, 86, 94, 101, 111, 118, 132, 141, 150, 159, 168, 180, 192, 203, 220, 235, 247, 261, 275, 289, 302, 324, 340, 361, 376, 394, 413, 433, 454, 472, 498, 518, 536, 560, 584, 606, 632, 658, 684
Offset: 1

Author

Bence Bernáth, Jun 22 2025

Keywords

Comments

The trivial x=y=z=w=0 solution is not included. The solutions are generated by the Vieta jumping discussed in the Numberphile video.

Examples

			a(3)=2 because the solutions below e^3=20.085... are [2,2,2,2] and [2,2,2,6]. One quadruplet solution is counted only once.
		

Crossrefs

Cf. A061292.

Programs

  • Python
    import math
    from collections import deque
    def is_perfect_square(n):
        return (math.isqrt(n)) ** 2 == n
    def generate_all_solutions(up_to_bound):
        solutions = set()
        visited = set()
        seed = (2, 2, 2, 2)
        queue = deque([seed])
        solutions.add(seed)
        while queue:
            quad = queue.popleft()
            for ii in range(4):
                rotated = list(quad[ii:] + quad[:ii])
                x, y, z, w = rotated
                product = y * z * w
                sumsq = y**2 + z**2 + w**2
                D = product**2 - 4 * sumsq
                if D < 0 or not is_perfect_square(D):
                    continue
                sqrt_D = (math.isqrt(D))
                for sign in [+1, -1]:
                    x_new = (product + sign * sqrt_D)
                    if x_new % 2 != 0:
                        continue
                    x_new //= 2
                    if not (0 < x_new < up_to_bound):
                        continue
                    new_quad = [x_new, y, z, w]
                    if any(val >= up_to_bound for val in new_quad):
                        continue
                    new_quad_sorted = tuple(sorted(new_quad))
                    if new_quad_sorted not in visited:
                        solutions.add(new_quad_sorted)
                        queue.append(tuple(new_quad))
                        visited.add(new_quad_sorted)
        return sorted(solutions)
    # Compute all solutions up to e^100
    max_bound = math.exp(100)
    all_solutions = generate_all_solutions(max_bound)
    # Precompute max entry of each solution for fast thresholding
    solution_maxes = [max(sol) for sol in all_solutions]
    # Generate the sequence a(n) for n = 1 to 100
    a_n = []
    for n in range(1, 101):
        threshold = math.exp(n)
        count = sum(1 for m in solution_maxes if m < threshold)
        a_n.append(count)
    print(a_n)

A369104 Decimal expansion of Pi*(Pi-2)/(4+(Pi-2)^2).

Original entry on oeis.org

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

Author

Bence Bernáth, Jan 13 2024

Keywords

Comments

This is the prefactor of the Hall resistivity of strange metals in the high magnetic field regime. The number comes from a phenomenological model using a modified Boltzmann equation. See the link for details.

Examples

			0.67627022268...
		

Crossrefs

Programs

  • Mathematica
    First[RealDigits[Pi*(Pi-2)/(4+(Pi-2)^2), 10, 120, 0]] (* Paolo Xausa, Jun 29 2024 *)
  • Python
    from sympy import pi, N;
    def A369104(n):
        return list(map(int, str(N((pi*(pi-2))/(4+(pi-2)**2), n)).replace(".", "")))

Extensions

Leading 0 removed and offset changed to 0 by Georg Fischer, Feb 03 2025

A369103 Decimal expansion of 2*Pi/(4+(Pi-2)^2).

Original entry on oeis.org

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

Author

Bence Bernáth, Jan 13 2024

Keywords

Comments

This is the prefactor of the linear magnetoresistance of strange metals in the high magnetic field regime. The number comes from a phenomenological model using a modified Boltzmann equation. See the link for details.

Examples

			1.18478376776...
		

Crossrefs

Programs

  • Mathematica
    First[RealDigits[2 Pi/(4+(Pi-2)^2), 10, 120]] (* Paolo Xausa, Jan 13 2024 *)
  • Python
    from sympy import pi, N;
    def A369103(n):
        return list(map(int, str(N(2*pi/(4+(pi-2)**2), n)).replace(".", "")))

A359031 a(n+1) gives the number of occurrences of the mode of the digits of a(n) among all the digits of [a(0), a(1), ..., a(n)], with a(0)=0.

Original entry on oeis.org

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

Author

Bence Bernáth, Dec 12 2022

Keywords

Comments

The mode is the most frequently occurring value among the digits of a(n). When there are multiple values occurring equally frequently, the mode is the smallest of those values.
Up to a(464)=110, the terms are identical to A358967.

Programs

  • MATLAB
    length_seq=470;
    sequence(1)=0;
    seq_for_digits=(num2str(sequence(1))-'0');
    for i1=1:1:length_seq
         sequence(i1+1)=sum(seq_for_digits==mode((num2str(sequence(i1))-'0'))');
         seq_for_digits=[seq_for_digits, num2str(sequence(i1+1))-'0'];
    end
    
  • Python
    import statistics as stat
    sequence=[0]
    length=470
    seq_for_digits=list(map(int, list(str(sequence[0]))))
    for ii in range(length):
        sequence.append(seq_for_digits.count(stat.mode(list(map(int, list(str(sequence[-1])))))))
        seq_for_digits.extend(list(map(int, list(str(sequence[-1])))))

A358851 a(n+1) is the number of occurrences of the largest digit of a(n) among all the digits of [a(0), a(1), ..., a(n)], with a(0)=0.

Original entry on oeis.org

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

Author

Bence Bernáth, Dec 08 2022

Keywords

Comments

Up to a(19)=10, the terms are identical to A248034. The branches (distinct lines of terms indicating the largest digit of the preceding term) can be labeled by the counter digit (shown in the scatter plot). From 9 to 1 the branches gradually get fragmented. Below digit 5 it is harder to disentangle the branches in some places. A repeating pattern also appears (shown in the inset of the scatter plot).

Crossrefs

Programs

A358967 a(n+1) gives the number of occurrences of the smallest digit of a(n) so far, up to and including a(n), with a(0)=0.

Original entry on oeis.org

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

Author

Bence Bernáth, Dec 08 2022

Keywords

Comments

Up to a(103)=12, the terms are identical to A248034.

Crossrefs

Programs

  • MATLAB
    length_seq=150;
    sequence(1)=0;
    seq_for_digits=(num2str(sequence(1))-'0');
    for i1=1:1:length_seq
         sequence(i1+1)=sum(seq_for_digits==min((num2str(sequence(i1))-'0'))');
         seq_for_digits=[seq_for_digits, num2str(sequence(i1+1))-'0'];
    end
    
  • Python
    sequence=[0]
    length=150
    seq_for_digits=list(map(int, list(str(sequence[0]))))
    for ii in range(length):
       sequence.append(seq_for_digits.count(min(list(map(int,list(str(sequence[-1])))))))
       seq_for_digits.extend(list(map(int, list(str(sequence[-1])))))

A358520 Nearest integer to n/sin(n).

Original entry on oeis.org

1, 2, 21, -5, -5, -21, 11, 8, 22, -18, -11, -22, 31, 14, 23, -56, -18, -24, 127, 22, 25, -2486, -27, -27, -189, 34, 28, 103, -44, -30, -77, 58, 33, 64, -82, -36, -57, 128, 40, 54, -258, -46, -52, 2486, 53, 51, 380, -62, -51, -191, 76, 53, 134, -97
Offset: 1

Author

Bence Bernáth, Nov 20 2022

Keywords

Comments

It is also the nearest integer to sinc(x)^(-1) function.

Examples

			For n=3, 3/sin(3) = 21.25..., therefore a(3) = 21.
		

Crossrefs

Cf. A046947 (Values for n where abs(a(n))/n has records).

Programs

  • Mathematica
    Table[Round[n/Sin[n]], {n, 1, 100}]
  • PARI
    a(n) = round(n/sin(n)); \\ Michel Marcus, Nov 20 2022

A337014 a(1) = 0 and for n > 1, a(n+1) = (k(n) - a(n))*(-1)^(n+1) where k(n) is the number of terms equal to a(n) among the first n terms.

Original entry on oeis.org

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

Author

Bence Bernáth, Nov 21 2020

Keywords

Comments

The graph of the sequence shows interesting, "Christmas tree"-like shapes.

Examples

			For n = 4, a(4) = 2, which appeared only once before, so a(5)=(1-2)*(-1)^5 = 1.
		

Crossrefs

Programs

  • MATLAB
    length=10000;
    sequence(1)=0;
    for n=2:1:length
         sequence(n)=((nnz(sequence==sequence(end)))-(sequence(n-1)))*(-1)^n;
    end
    
  • Mathematica
    a = {0}; Do[AppendTo[a, (-1)^k*(Count[a, a[[-1]]] - a[[-1]])], {k, 0, 81}]; a (* Amiram Eldar, Nov 21 2020 *)
  • PARI
    { for (n=1, #a=vector(83), print1(a[n]=if (n==1, 0, k=sum(k=1, n-1, a[k]==a[n-1]); (k-a[n-1])*(-1)^n) ", ")) } \\ Rémy Sigrist, Nov 22 2020
    
  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        an, k, sign = 0, Counter(), -1
        while True:
            yield an
            k[an] += 1
            sign *= -1
            an = (k[an] - an)*sign
    print(list(islice(agen(), 83))) # Michael S. Branicky, Nov 12 2022

A337835 a(1) = 0 and for n > 1, a(n+1) = k - a(n) where k is the number of terms equal to a(n) among the first n terms.

Original entry on oeis.org

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

Author

Bence Bernáth, Nov 17 2020

Keywords

Comments

Empirical observation: -A000194(n) <= a(n) <= A000194(n).

Examples

			For n = 4, a(4) = 2, which appeared only once in the sequence so a(5)=1-2=-1.
		

Crossrefs

Programs

  • MATLAB
    length=1000;
    sequence(1)=0;
    for n=2:1:length
            sequence(n)=nnz(sequence==sequence(end))-sequence(n-1);
    end
    
  • Mathematica
    a = {0}; Do[AppendTo[a, Count[a, a[[-1]]] - a[[-1]]], {100}]; a (* Amiram Eldar, Nov 18 2020 *)
    a[1] = 0; a[n_Integer?Positive] := a[n] = Count[Array[a, n - 1], a[n - 1]] - a[n - 1]; Array[a, 101] (* Jan Mangaldan, Nov 27 2020 *)
  • PARI
    lista(nn) = {my(va = vector(nn)); for (n=2, nn, va[n] = #select(x->(x==va[n-1]), vector(n-1, k, va[k])) - va[n-1];); va;} \\ Michel Marcus, Nov 18 2020
    
  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        an, k = 0, Counter()
        while True:
            yield an
            k[an] += 1
            an = k[an] - an
    print(list(islice(agen(), 86))) # Michael S. Branicky, Nov 12 2022