A306436 Rewrite n by substituting each digit d of n by d-1 if d is odd, d+1 otherwise.
1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 41, 40, 43, 42, 45, 44, 47, 46, 49, 48, 71, 70, 73, 72, 75, 74, 77, 76, 79, 78, 61, 60, 63, 62, 65, 64, 67, 66, 69, 68, 91, 90, 93, 92, 95, 94, 97, 96, 99, 98, 81, 80, 83, 82, 85, 84, 87, 86, 89, 88, 11, 10
Offset: 0
Examples
a(0)=1, a(1)=0, a(2)=3, ... , a(10)=01=1, a(11)=00=0, a(12)=03=3, ... , a(20)=31, ... , a(100)=011=11, a(101)=010=10, a(102)=013=13. a(2n) = 1, 3, 5, 7, 9, 1, 3, 5, 7, 9, 31, 33, 35, 37, 39, 21, 23, 25, 27, 29, 51, ... .
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Crossrefs
Cf. A001477.
Programs
-
Maple
f:= proc(n) option remember; local d; d:= n mod 10; d + (-1)^d + 10*procname((n-d)/10) end proc: for i from 0 to 9 do f(i):= i + (-1)^i od: map(f, [$0..100]); # Robert Israel, Feb 20 2019
-
Mathematica
A306436[n_]:=FromDigits[Map[#+If[OddQ[#],-1,1]&,IntegerDigits[n]]];Array[A306436,100,0] (* Paolo Xausa, Nov 13 2023 *)
-
PARI
substi(d)=my(vs = [1,0,3,2,5,4,7,6,9,8]); fromdigits(apply(x->vs[x+1], d)); a(n) = if (n==0, substi([0]), substi(digits(n))); \\ Michel Marcus, Feb 15 2019
-
Python
def A306436(n): return int(str(n).translate({48:49,49:48,50:51,51:50,52:53,53:52,54:55,55:54,56:57,57:56})) # Chai Wah Wu, Apr 07 2022
Extensions
Name changed by Paolo Xausa, Nov 13 2023
Comments