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.

Showing 1-4 of 4 results.

A345497 Numbers that are the sum of eight squares in ten or more ways.

Original entry on oeis.org

70, 71, 73, 74, 77, 78, 79, 80, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131
Offset: 1

Views

Author

David Consiglio, Jr., Jun 20 2021

Keywords

Examples

			71 = 1^2 + 1^2 + 1^2 + 1^2 + 1^2 + 1^2 + 1^2 + 8^2
   = 1^2 + 1^2 + 1^2 + 1^2 + 1^2 + 1^2 + 4^2 + 7^2
   = 1^2 + 1^2 + 1^2 + 1^2 + 1^2 + 4^2 + 5^2 + 5^2
   = 1^2 + 1^2 + 1^2 + 2^2 + 4^2 + 4^2 + 4^2 + 4^2
   = 1^2 + 1^2 + 1^2 + 3^2 + 3^2 + 3^2 + 4^2 + 5^2
   = 1^2 + 1^2 + 2^2 + 2^2 + 2^2 + 2^2 + 2^2 + 7^2
   = 1^2 + 1^2 + 2^2 + 2^2 + 2^2 + 4^2 + 4^2 + 5^2
   = 1^2 + 2^2 + 2^2 + 2^2 + 2^2 + 2^2 + 5^2 + 5^2
   = 1^2 + 2^2 + 2^2 + 2^2 + 2^2 + 3^2 + 3^2 + 6^2
   = 1^2 + 3^2 + 3^2 + 3^2 + 3^2 + 3^2 + 3^2 + 4^2
   = 2^2 + 2^2 + 2^2 + 3^2 + 3^2 + 3^2 + 4^2 + 4^2
so 71 is a term.
		

Crossrefs

Programs

  • Python
    from itertools import combinations_with_replacement as cwr
    from collections import defaultdict
    keep = defaultdict(lambda: 0)
    power_terms = [x**2 for x in range(1, 1000)]
    for pos in cwr(power_terms, 8):
        tot = sum(pos)
        keep[tot] += 1
        rets = sorted([k for k, v in keep.items() if v >= 10])
        for x in range(len(rets)):
            print(rets[x])
    
  • Python
    def A345397(n): return (70, 71, 73, 74, 77, 78, 79, 80, 82, 83)[n-1] if n<11 else n+74 # Chai Wah Wu, May 09 2024

Formula

From Chai Wah Wu, May 09 2024: (Start)
All integers >= 85 are terms. Proof: since 594 can be written as the sum of 3 positive squares in 10 ways (see A025427) and any integer >= 34 can be written as a sum of 5 positive squares (see A025429), any integer >= 628 can be written as a sum of 8 positive squares in 10 or more ways. Integers from 85 to 627 are terms by inspection.
a(n) = 2*a(n-1) - a(n-2) for n > 12.
G.f.: x*(-x^11 + x^10 - x^9 + x^8 - 2*x^5 + 2*x^4 - x^3 + x^2 - 69*x + 70)/(x - 1)^2. (End)

A353139 Digitally balanced numbers (A031443) whose squares are also digitally balanced.

Original entry on oeis.org

212, 781, 794, 806, 817, 838, 841, 844, 865, 2962, 3101, 3130, 3171, 3178, 3185, 3213, 3219, 3226, 3269, 3274, 3335, 3353, 3354, 3356, 3370, 3378, 3490, 3496, 3521, 3528, 3595, 3597, 3606, 3610, 3626, 3651, 3672, 3718, 3777, 11797, 11798, 11850, 11938, 12049
Offset: 1

Views

Author

Alex Ratushnyak, Apr 26 2022

Keywords

Comments

Numbers x such that both x and x^2 are terms of A031443, that is, have the same number of 0's as 1's in their binary representations.

Crossrefs

Programs

  • Mathematica
    balQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ @ (m = Length @ d) && Count[d, 1] == m/2]; Select[Range[12000], balQ[#] && balQ[#^2] &] (* Amiram Eldar, Apr 26 2022 *)
  • Python
    from itertools import count, islice
    from sympy.utilities.iterables import multiset_permutations
    def isbalanced(n): b = bin(n)[2:]; return b.count("0") == b.count("1")
    def A031443gen(): yield from (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1)))
    def agen():
        for k in A031443gen():
            if isbalanced(k**2):
                yield k
    print(list(islice(agen(), 40))) # Michael S. Branicky, Apr 26 2022

A345396 a(n) is the least prime p such that {p, p^2, ..., p^n} are all digitally balanced numbers in base 2 (A031443).

Original entry on oeis.org

2, 12049, 52673, 937253, 1000099, 3844790441, 62911443401, 1052000152157
Offset: 1

Views

Author

Amiram Eldar, Jun 17 2021

Keywords

Comments

a(9) > 2.5 * 10^12, if it exists.

Examples

			a(1) = 2 since 2 is digitally balanced: its binary representation, 10, has the same number of 0's and 1's.
a(2) = 12049 since both 12049 and 12049^2 are digitally balanced: the binary representation of 12049, 10111100010001, has 7 0's and 7 1's, and the binary representation of 12049^2, 1000101001110011111100100001, has 14 0's and 14 1's.
		

Crossrefs

Subsequence of A031443, A066196 and A345395.
Cf. A345397.

Programs

  • Mathematica
    balQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ @ (m = Length @ d) && Count[d, 1] == m/2]; f[p_] := Module[{e = 0, r = p}, While[balQ[r], r *= p; e++]; e]; mx = 5; s = Table[0, {mx}]; c = 0; p = 2; While[c < mx, k = f[p]; Do[If[s[[i]] == 0, s[[i]] = p; c++], {i, 1, k}]; p = NextPrime[p]]; s
  • Python
    from itertools import count, islice
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def isbalanced(n): b = bin(n)[2:]; return b.count("0") == b.count("1")
    def A066196gen():
        yield from filter(isprime, (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1))))
    def a(n):
        for p in A066196gen():
            if all(isbalanced(p**i) for i in range(2, n+1)):
                return p
    print([a(n) for n in range(1, 6)]) # Michael S. Branicky, May 15 2022

A353140 Digitally balanced numbers (A031443) whose squares and cubes are also digitally balanced.

Original entry on oeis.org

3274, 13453, 13492, 13706, 14726, 15113, 15498, 15528, 52049, 52251, 52330, 52673, 52778, 53478, 53684, 53775, 53972, 54295, 54411, 54598, 54601, 55057, 55449, 55462, 55505, 55512, 55689, 56333, 58066, 58260, 58446, 58453, 58470, 58918, 59266, 59722, 59786
Offset: 1

Views

Author

Alex Ratushnyak, Apr 26 2022

Keywords

Comments

Numbers x such that x, x^2 and x^3 are terms of A031443, that is, have the same number of 0's as 1's in their binary representations.

Crossrefs

Programs

  • Mathematica
    balQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ @ (m = Length @ d) && Count[d, 1] == m/2]; Select[Range[60000], balQ[#] && balQ[#^2] && balQ[#^3] &] (* Amiram Eldar, Apr 26 2022 *)
  • Python
    from itertools import count, islice
    from sympy.utilities.iterables import multiset_permutations
    def isbalanced(n): b = bin(n)[2:]; return b.count("0") == b.count("1")
    def A031443gen(): yield from (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1)))
    def agen():
        for k in A031443gen():
            if isbalanced(k**2) and isbalanced(k**3):
                yield k
    print(list(islice(agen(), 40))) # Michael S. Branicky, Apr 26 2022
Showing 1-4 of 4 results.