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!)
A352152 Reverse each run of consecutive nonzero digits in the decimal expansion of n. 1
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 20, 12, 22, 32, 42, 52, 62, 72, 82, 92, 30, 13, 23, 33, 43, 53, 63, 73, 83, 93, 40, 14, 24, 34, 44, 54, 64, 74, 84, 94, 50, 15, 25, 35, 45, 55, 65, 75, 85, 95, 60, 16, 26, 36, 46, 56, 66, 76 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers.
This sequence first differs from A321474 for n = 102: a(102) = 102 whereas A321474(102) = 201.
This sequence first differs from A333659 for n = 101: a(101) = 101 whereas A333659(101) = 110.
This sequence first differs from A336956 for n = 102: a(102) = 102 whereas A336956(102) = 201.
LINKS
FORMULA
a(10*n) = 10*a(n).
EXAMPLE
For n = 1024:
- we have two runs of consecutive nonzero digits: "1" and "24",
- the reverse of "1" is "1", that of "24" is "42",
- so a(1024) = 1042.
PROG
(Perl) sub a { my $v = shift; $v =~ s/[1-9]+/reverse($&)/ge; return $v; }
(Python)
from itertools import groupby
def A352152(n): return int(''.join(''.join(list(g) if k else list(g)[::-1]) for k, g in groupby(str(n), key=lambda x:x =='0'))) # Chai Wah Wu, Mar 08 2022
CROSSREFS
Sequence in context: A321474 A333659 A336956 * A225805 A068637 A004186
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Mar 06 2022
STATUS
approved

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 July 14 22:52 EDT 2024. Contains 374323 sequences. (Running on oeis4.)