login
Increment all even digits of n.
1

%I #16 Apr 08 2022 08:17:25

%S 1,1,3,3,5,5,7,7,9,9,11,11,13,13,15,15,17,17,19,19,31,31,33,33,35,35,

%T 37,37,39,39,31,31,33,33,35,35,37,37,39,39,51,51,53,53,55,55,57,57,59,

%U 59,51,51,53,53,55,55,57,57,59,59,71,71,73,73,75,75,77,77

%N Increment all even digits of n.

%t Array[FromDigits@ Map[If[EvenQ[#], # + 1, #] &, IntegerDigits[#]] &, 78, 0] (* _Michael De Vlieger_, Feb 17 2022 *)

%o (Python 3)

%o for n in range(1000):

%o s = str(n)

%o res = ''

%o for d in s:

%o if (int(d) & 1)==0: d = str(int(d)+1)

%o res += d

%o print(int(res), end=',')

%o (Python)

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

%o (PARI) a(n) = if (n, fromdigits(apply(x->if(!(x%2),x+1,x), digits(n))), 1); \\ _Michel Marcus_, Feb 18 2022

%Y Cf. A001613, A306436, A106747.

%K nonn,base

%O 0,3

%A _Alex Ratushnyak_, Feb 17 2022