[go: up one dir, main page]

login
A171798
a(n) = base-10 concatenation XYZ, where X = number of bits in binary expansion of n, Y = number of 0's, Z = number of 1's.
8
101, 211, 202, 321, 312, 312, 303, 431, 422, 422, 413, 422, 413, 413, 404, 541, 532, 532, 523, 532, 523, 523, 514, 532, 523, 523, 514, 523, 514, 514, 505, 651, 642, 642, 633, 642, 633, 633, 624, 642, 633, 633, 624, 633, 624, 624, 615, 642, 633, 633, 624
OFFSET
1,1
COMMENTS
Start with n, repeatedly apply the map i -> a(i). Then every n converges to one of 1019, 1147, 1165 or 14311 (cf. A171813). Proof: this is true by direct calculation for n=1..2^14. For larger n, a(n) < n.
LINKS
EXAMPLE
14 = 1110 in base 2, so X=4, Y=1, Z=3, a(14)=413.
MAPLE
# Maple code for trajectories of numbers from 1 to M:
F:=proc(n) local s, t1, t2; t1:=convert(n, base, 2); t2:=nops(t1); s:=add(t1[i], i=1..t2);
parse(cat(t2, t2-s, s)); end;
M:=16384;
for n from 1 to M do t3:=F(n); sw:=-1;
for i from 1 to 10 do
if (t3 = 1147) or (t3 = 1165) or (t3 = 1019) or (t3 = 14311) then sw:=1; break; fi;
t3:=F(t3);
od;
if sw < 0 then lprint(n); fi;
od:
Contribution from R. J. Mathar, Oct 15 2010: (Start)
read("transforms") ; cat2 := proc(a, b) dgsb := max(1, ilog10(b)+1) ; a*10^dgsb+b ; end proc:
catL := proc(L) local a; a := op(1, L) ; for i from 2 to nops(L) do a := cat2(a, op(i, L)) ; end do; a; end proc:
A070939 := proc(n) max(1, ilog2(n)+1) ; end proc:
A171798 := proc(n) local n1, n3 ; n1 := A070939(n) ; n3 := wt(n) ; catL([n1, n1-n3, n3]) ; end proc:
seq(A171798(n), n=1..80) ; (End)
MATHEMATICA
ans[n_]:=Module[{idn2=IntegerDigits[n, 2]}, FromDigits[{Length[idn2], Count[idn2, 0], Count[idn2, 1]}]]; Table[ans[i], {i, 50}] (* Harvey P. Dale, Nov 06 2010 *)
PROG
(Haskell)
a171798 n = read $ concatMap (show . ($ n))
[a070939, a023416, a000120] :: Integer
-- Reinhard Zumkeller, Feb 22 2012
(Python)
def a(n):
b = bin(n)[2:]
z = b.count("0")
return int(str(len(b)) + str(z) + str(len(b)-z))
print([a(n) for n in range(1, 52)]) # Michael S. Branicky, Mar 28 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
N. J. A. Sloane, Oct 15 2010, Oct 16 2010
EXTENSIONS
More terms from R. J. Mathar, Oct 15 2010
STATUS
approved