A222228 In the number n, replace all (decimal) digits '2' with '4' and vice versa.
0, 1, 4, 3, 2, 5, 6, 7, 8, 9, 10, 11, 14, 13, 12, 15, 16, 17, 18, 19, 40, 41, 44, 43, 42, 45, 46, 47, 48, 49, 30, 31, 34, 33, 32, 35, 36, 37, 38, 39, 20, 21, 24, 23, 22, 25, 26, 27, 28, 29, 50, 51, 54, 53, 52, 55, 56, 57, 58, 59, 60, 61, 64, 63, 62, 65, 66
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Programs
-
Mathematica
a[n_]:= IntegerDigits[n]/.{2->4, 4->2} // FromDigits; Table[a[n], {n, 0, 80}] (* Vincenzo Librandi, Jul 30 2013 *)
-
PARI
A222228(n,d=[0,1,4,3,2,5,6,7,8,9])=sum(i=1, #n=digits(n), d[n[i]+1]*10^(#n-i)) \\ gives correct value for n=0 iff d[1]=0, since digits(0)=[] in PARI (v.2.6)
Comments