login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A306436
Rewrite n by substituting each digit d of n by d-1 if d is odd, d+1 otherwise.
2
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,3
COMMENTS
The original name was: The nonnegative integers, the ten successive digits being swapped by pairs.
0<->1, 2<->3, 4<->5, 6<->7, 8<->9.
LINKS
EXAMPLE
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, ... .
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 *)
PROG
(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
CROSSREFS
Cf. A001477.
Sequence in context: A066250 A066251 A114882 * A355504 A004442 A065190
KEYWORD
nonn,base,easy
AUTHOR
Paul Curtz, Feb 15 2019
EXTENSIONS
Name changed by Paolo Xausa, Nov 13 2023
STATUS
approved