OFFSET
1,1
EXAMPLE
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.
MATHEMATICA
balQ[n_, b_] := MinMax@ Differences@ DigitCount[n, b] == {0, 0}; Select[Range[320000], balQ[#, 3] && balQ[#^2, 3] &] (* Amiram Eldar, Jun 03 2024 *)
PROG
(Magma) bal:=func<n|Multiplicity(Intseq(n, 3), 1) eq Multiplicity(Intseq(n, 3), 0) and Multiplicity(Intseq(n, 3), 1) eq Multiplicity(Intseq(n, 3), 2)>; [n:n in [1..320000]|bal(n) and bal(n*n)];
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Marius A. Burtea, May 23 2024
STATUS
approved