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.

A345397 a(n) is the least number k such that {k, k^2, ..., k^n} are all digitally balanced numbers in base 2 (A031443), or 0 if no such k exists.

Original entry on oeis.org

2, 212, 3274, 15113, 236417, 15975465, 991017155, 4006725713, 4079348720699
Offset: 1

Views

Author

Amiram Eldar, Jun 17 2021

Keywords

Comments

Conjecture: all a(n) > 0. - Alex Ratushnyak, Apr 26 2022

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) = 212 since both 212 and 212^2 are digitally balanced: the binary representation of 212, 11010100, has 4 0's and 4 1's, and the binary representation of 212^2, 1010111110010000, has 8 0's and 8 1's.
		

Crossrefs

Programs

  • Mathematica
    balQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ @ (m = Length @ d) && Count[d, 1] == m/2]; f[k_] := Module[{e = 0, r = k}, While[balQ[r], r *= k; e++]; e]; mx = 5; s = Table[0, {mx}]; c = 0; n = 1; While[c < mx, k = f[n]; Do[If[s[[i]] == 0, s[[i]] = n; c++], {i, 1, k}]; n++]; s
  • 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 a(n):
        for k in A031443gen():
            if all(isbalanced(k**i) for i in range(2, n+1)):
                return k
    print([a(n) for n in range(1, 6)]) # Michael S. Branicky, Apr 26 2022

Extensions

a(9) from Bert Dobbelaere, Jun 18 2021
Name edited by Alex Ratushnyak, Apr 26 2022

A351599 a(n) is the smallest integer m > 0 such that m*n is a digitally balanced number (A031443).

Original entry on oeis.org

2, 1, 3, 3, 2, 2, 5, 7, 1, 1, 4, 1, 4, 3, 9, 15, 9, 10, 2, 9, 2, 2, 8, 9, 2, 2, 5, 2, 8, 5, 17, 31, 5, 5, 1, 5, 1, 1, 4, 6, 1, 1, 4, 1, 3, 4, 3, 5, 1, 1, 3, 1, 4, 4, 3, 1, 4, 4, 3, 3, 13, 9, 33, 63, 3, 3, 3, 3, 10, 3, 2, 3, 11, 9, 2, 3, 2, 2, 8, 3, 10, 9, 2
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]; a[n_] := Module[{k = 1}, While[!balQ[k*n], k++]; k]; Array[a, 100] (* Amiram Eldar, May 02 2022 *)
  • PARI
    is(n) = hammingweight(n)==hammingweight(bitneg(n, #binary(n))); \\ A031443
    a(n) = my(m=1); while (!is(m*n), m++); m; \\ Michel Marcus, May 02 2022

Formula

a(n) = A143146(n) / n. - Rémy Sigrist, Jul 11 2022

A143147 a(1)=2. a(n) = the smallest positive multiple of a(n-1) that is > a(n-1) and has the same number of 0's as 1's in its binary representation.

Original entry on oeis.org

2, 10, 50, 150, 3150, 9450, 141750, 850500, 11056500, 154791000, 773955000, 41019615000, 1066509990000, 3199529970000, 15997649850000, 239964747750000, 2399647477500000, 43193654595000000, 2893974857865000000
Offset: 1

Views

Author

Leroy Quet, Jul 27 2008

Keywords

Crossrefs

Extensions

a(5)-a(19) from Donovan Johnson, Sep 03 2008

A355640 a(0) = 0, and for any n > 0, a(n) is the least positive multiple of n whose balanced ternary expansion contains as many negative trits as positive trits.

Original entry on oeis.org

0, 2, 2, 6, 8, 20, 6, 56, 8, 18, 20, 154, 24, 26, 56, 60, 16, 136, 18, 266, 20, 168, 154, 46, 24, 400, 26, 54, 56, 232, 60, 62, 32, 462, 136, 70, 72, 74, 266, 78, 80, 164, 168, 86, 440, 180, 46, 188, 48, 98, 400, 408, 52, 424, 54, 440, 56, 798, 232, 236, 60
Offset: 0

Views

Author

Rémy Sigrist, Jul 11 2022

Keywords

Comments

A174658 corresponds to fixed points.

Examples

			For n = 5:
- the first multiple of 5 (alongside their balanced ternary expansions) are:
      k  k*5  bter(k*5)  #1  #T
      -  ---  ---------  --  --
      1    5        1TT   1   2
      2   10        101   2   0
      3   15       1TT0   1   2
      4   20       1T1T   2   2
- negative and positive trits are first balanced for k = 4,
- so a(5) = 4*5 = 20.
		

Crossrefs

See A143146 for a similar sequence.
Cf. A065363, A174658 (fixed points), A355639.

Programs

  • PARI
    a(n) = { for (k=1, oo, my (m=k*n, s=0, d); while (m, m=(m-d=[0, 1, -1][1+m%3])/3; s+=d); if (s==0, return (k*n))) }

Formula

a(n) = n * A355639(n).
Showing 1-4 of 4 results.