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.
%I A345397 #19 Jun 10 2022 11:09:04 %S A345397 2,212,3274,15113,236417,15975465,991017155,4006725713,4079348720699 %N 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. %C A345397 Conjecture: all a(n) > 0. - _Alex Ratushnyak_, Apr 26 2022 %e A345397 a(1) = 2 since 2 is digitally balanced: its binary representation, 10, has the same number of 0's and 1's. %e A345397 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. %t A345397 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 %o A345397 (Python) %o A345397 from itertools import count, islice %o A345397 from sympy.utilities.iterables import multiset_permutations %o A345397 def isbalanced(n): b = bin(n)[2:]; return b.count("0") == b.count("1") %o A345397 def A031443gen(): yield from (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1))) %o A345397 def a(n): %o A345397 for k in A031443gen(): %o A345397 if all(isbalanced(k**i) for i in range(2, n+1)): %o A345397 return k %o A345397 print([a(n) for n in range(1, 6)]) # _Michael S. Branicky_, Apr 26 2022 %Y A345397 Cf. A031443, A143146, A345396. %K A345397 nonn,base,more %O A345397 1,1 %A A345397 _Amiram Eldar_, Jun 17 2021 %E A345397 a(9) from _Bert Dobbelaere_, Jun 18 2021 %E A345397 Name edited by _Alex Ratushnyak_, Apr 26 2022