login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A353139 Digitally balanced numbers (A031443) whose squares are also digitally balanced. 2
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
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.
LINKS
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 *)
PROG
(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
CROSSREFS
Sequence in context: A158794 A204364 A235180 * A114880 A348831 A200433
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, Apr 26 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 23:40 EDT 2024. Contains 371798 sequences. (Running on oeis4.)