login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A306436 Rewrite n by substituting each digit d of n by d-1 if d is odd, d+1 otherwise. 2

%I #31 Nov 13 2023 08:45:24

%S 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,

%T 38,21,20,23,22,25,24,27,26,29,28,51,50,53,52,55,54,57,56,59,58,41,40,

%U 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

%N Rewrite n by substituting each digit d of n by d-1 if d is odd, d+1 otherwise.

%C The original name was: The nonnegative integers, the ten successive digits being swapped by pairs.

%C 0<->1, 2<->3, 4<->5, 6<->7, 8<->9.

%H Robert Israel, <a href="/A306436/b306436.txt">Table of n, a(n) for n = 0..10000</a>

%e 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.

%e a(2n) = 1, 3, 5, 7, 9, 1, 3, 5, 7, 9, 31, 33, 35, 37, 39, 21, 23, 25, 27, 29, 51, ... .

%p f:= proc(n) option remember; local d;

%p d:= n mod 10;

%p d + (-1)^d + 10*procname((n-d)/10)

%p end proc:

%p for i from 0 to 9 do f(i):= i + (-1)^i od:

%p map(f, [$0..100]); # _Robert Israel_, Feb 20 2019

%t A306436[n_]:=FromDigits[Map[#+If[OddQ[#],-1,1]&,IntegerDigits[n]]];Array[A306436,100,0] (* _Paolo Xausa_, Nov 13 2023 *)

%o (PARI) substi(d)=my(vs = [1,0,3,2,5,4,7,6,9,8]); fromdigits(apply(x->vs[x+1], d));

%o a(n) = if (n==0, substi([0]), substi(digits(n))); \\ _Michel Marcus_, Feb 15 2019

%o (Python)

%o 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

%Y Cf. A001477.

%K nonn,base,easy

%O 0,3

%A _Paul Curtz_, Feb 15 2019

%E Name changed by _Paolo Xausa_, Nov 13 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 11 10:40 EDT 2024. Contains 372409 sequences. (Running on oeis4.)