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-3 of 3 results.

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

A351598 Digitally balanced numbers b (A031443) such that b^b is also digitally balanced.

Original entry on oeis.org

49, 8677, 53543, 141169, 202055, 755917
Offset: 1

Views

Author

Alex Ratushnyak, May 02 2022

Keywords

Crossrefs

Programs

  • Mathematica
    balQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ @ (m = Length @ d) && Count[d, 1] == m/2]; Select[Range[10000], balQ[#] && balQ[#^#] &] (* Amiram Eldar, May 03 2022 *)
  • Python
    from itertools import count, islice
    def isdb(n): b = bin(n)[2:]; return b.count("0") == b.count("1")
    def agen(): yield from (b for b in count(1) if isdb(b) and isdb(b**b))
    print(list(islice(agen(), 2))) # Michael S. Branicky, Jun 12 2022

Extensions

a(4)-a(6) from Amiram Eldar, May 03 2022

A372147 Numbers k for which k and k^2 are digitally balanced numbers in base 3 (A049354).

Original entry on oeis.org

500, 544, 550, 552, 588, 622, 307172, 307402, 307888, 308920, 309480, 309522, 309604, 310348, 310422, 310658, 310754, 310964, 310974, 310980, 311206, 311214, 311342, 311466, 311582, 311788, 311790, 312050, 312070, 312100, 313022, 313050, 313336, 313502, 313512
Offset: 1

Views

Author

Marius A. Burtea, May 23 2024

Keywords

Examples

			500 = 200112_3 and 500^2 = 250000 =110200221021_3, so 500 is a term.
544 = 202011_3 and 544^2 = 295936 =120000221121_3, so 544 is a term.
		

Crossrefs

Programs

  • Magma
    bal:=func; [n:n in [1..320000]|bal(n) and bal(n*n)];
  • Mathematica
    balQ[n_, b_] := MinMax@ Differences@ DigitCount[n, b] == {0, 0}; Select[Range[320000], balQ[#, 3] && balQ[#^2, 3] &] (* Amiram Eldar, Jun 03 2024 *)
Showing 1-3 of 3 results.