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.

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.

This page as a plain text file.
%I A171798 #18 Jul 16 2022 11:49:58
%S A171798 101,211,202,321,312,312,303,431,422,422,413,422,413,413,404,541,532,
%T A171798 532,523,532,523,523,514,532,523,523,514,523,514,514,505,651,642,642,
%U A171798 633,642,633,633,624,642,633,633,624,633,624,624,615,642,633,633,624
%N 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.
%C A171798 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.
%H A171798 Reinhard Zumkeller, <a href="/A171798/b171798.txt">Table of n, a(n) for n = 1..10000</a>
%e A171798 14 = 1110 in base 2, so X=4, Y=1, Z=3, a(14)=413.
%p A171798 # Maple code for trajectories of numbers from 1 to M:
%p A171798 F:=proc(n) local s,t1,t2; t1:=convert(n,base,2); t2:=nops(t1); s:=add(t1[i],i=1..t2);
%p A171798 parse(cat(t2,t2-s,s)); end;
%p A171798 M:=16384;
%p A171798 for n from 1 to M do t3:=F(n); sw:=-1;
%p A171798 for i from 1 to 10 do
%p A171798 if (t3 = 1147) or (t3 = 1165) or (t3 = 1019) or (t3 = 14311) then sw:=1; break; fi;
%p A171798 t3:=F(t3);
%p A171798 od;
%p A171798 if sw < 0 then lprint(n); fi;
%p A171798 od:
%p A171798 Contribution from _R. J. Mathar_, Oct 15 2010: (Start)
%p A171798 read("transforms") ; cat2 := proc(a,b) dgsb := max(1,ilog10(b)+1) ; a*10^dgsb+b ; end proc:
%p A171798 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:
%p A171798 A070939 := proc(n) max(1,ilog2(n)+1) ; end proc:
%p A171798 A171798 := proc(n) local n1,n3 ; n1 := A070939(n) ; n3 := wt(n) ; catL([n1,n1-n3,n3]) ; end proc:
%p A171798 seq(A171798(n),n=1..80) ; (End)
%t A171798 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 *)
%o A171798 (Haskell)
%o A171798 a171798 n = read $ concatMap (show . ($ n))
%o A171798                    [a070939, a023416, a000120] :: Integer
%o A171798 -- _Reinhard Zumkeller_, Feb 22 2012
%o A171798 (Python)
%o A171798 def a(n):
%o A171798     b = bin(n)[2:]
%o A171798     z = b.count("0")
%o A171798     return int(str(len(b)) + str(z) + str(len(b)-z))
%o A171798 print([a(n) for n in range(1, 52)]) # _Michael S. Branicky_, Mar 28 2022
%Y A171798 Cf. A171797, A171813, A171823, A171825.
%Y A171798 Cf. A070939, A023416, A000120.
%K A171798 nonn,base,easy
%O A171798 1,1
%A A171798 _N. J. A. Sloane_, Oct 15 2010, Oct 16 2010
%E A171798 More terms from _R. J. Mathar_, Oct 15 2010