A222211 In the number n, replace all (decimal) digits '0' with '2' and vice versa.
2, 1, 0, 3, 4, 5, 6, 7, 8, 9, 12, 11, 10, 13, 14, 15, 16, 17, 18, 19, 2, 1, 0, 3, 4, 5, 6, 7, 8, 9, 32, 31, 30, 33, 34, 35, 36, 37, 38, 39, 42, 41, 40, 43, 44, 45, 46, 47, 48, 49, 52, 51, 50, 53, 54, 55, 56, 57, 58, 59, 62, 61, 60, 63, 64, 65, 66, 67, 68, 69, 72, 71, 70, 73, 74, 75
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Programs
-
Mathematica
a[n_]:= IntegerDigits[n]/.{0->2, 2->0} // FromDigits; Table[a[n], {n, 0, 80}] (* Vincenzo Librandi, Jul 29 2013 *)
-
PARI
A222211(n,d=[2,1,0,3,4,5,6,7,8,9])={sum(i=1,#n=digits(n),d[n[i]+1]*10^(#n-i),!n*d[1])} \\ N.B.: digits(0)=[] in PARI (v.2.6)
-
Perl
print join(",", map{tr/02/20/; $+0}(0..75)); # _Georg Fischer, Apr 06 2019
Comments