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!)
A372317 For any n > 0 with leading ternary digit h = A122586(n), reverse digits in blocks in ternary expansion of n where blocks are separated by h's; a(0) = 0. 2
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 12, 13, 14, 11, 16, 17, 18, 21, 20, 19, 22, 23, 24, 25, 26, 27, 28, 45, 30, 31, 32, 33, 46, 51, 36, 37, 42, 39, 40, 41, 38, 43, 44, 29, 34, 47, 48, 49, 50, 35, 52, 53, 54, 63, 56, 57, 66, 65, 60, 61, 62, 55, 64, 59, 58, 67 (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 has infinitely many fixed points (A125292, among others).
LINKS
EXAMPLE
For n = 5323: the ternary expansion of 5323 is "21022011", the corresponding leading digit is "2", we have three blocks: "10", "" and "011", their reversals are: "01", "" and "110", so the ternary expansion of a(5323) is "20122110", and a(5323) = 4845.
PROG
(PARI) a(n, base = 3) = { my (d = digits(n, base), i = 1); for (j = 2, #d+1, if (j==#d+1 || d[i]==d[j], my (ii = i+1, jj = j-1); while (ii < jj, [d[ii], d[jj]] = [d[jj], d[ii]]; ii++; jj--; ); i = j; ); ); fromdigits(d, base); }
CROSSREFS
See A367307 and A372318 for similar sequences.
Sequence in context: A271838 A194846 A194057 * A117923 A117924 A239616
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 27 2024
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 17 08:16 EDT 2024. Contains 374360 sequences. (Running on oeis4.)