login
Replace each odd digit d of n with (d-1)/2 and each even digit d with d/2.
3

%I #15 Apr 08 2022 08:14:27

%S 0,0,1,1,2,2,3,3,4,4,0,0,1,1,2,2,3,3,4,4,10,10,11,11,12,12,13,13,14,

%T 14,10,10,11,11,12,12,13,13,14,14,20,20,21,21,22,22,23,23,24,24,20,20,

%U 21,21,22,22,23,23,24,24,30,30,31,31,32,32,33,33,34,34,30,30,31,31,32,32

%N Replace each odd digit d of n with (d-1)/2 and each even digit d with d/2.

%C Terms are repeated. Differs from A004526 and A021895 starting with a(11)=0, A004526(11)=A021895(11)=5.

%H Reinhard Zumkeller, <a href="/A106747/b106747.txt">Table of n, a(n) for n = 0..10000</a>

%t a[n_]:=FromDigits[Map[If[Mod[ #, 2]==1, (#-1)/2, #/2]&, IntegerDigits[n]]];Table[a[n], {n, 0, 100}]

%o (Haskell)

%o a106747 n = if n == 0 then 0 else 10 * (a106747 n') + div d 2

%o where (n', d) = divMod n 10

%o -- _Reinhard Zumkeller_, Jan 14 2015

%o (Python)

%o def A106747(n): return int(str(n).translate({49:48,50:49,51:49,52:50,53:50,54:51,55:51,56:52,57:52})) # _Chai Wah Wu_, Apr 07 2022

%Y Cf. A004526, A021895, A107128, A107130.

%K nonn,base,look

%O 0,5

%A _Zak Seidov_, May 12 2005