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!)
A327886 Digits d in decimal expansion of n replaced with d-th digit of n (keeping the digits 0). If n does not have enough digits to index, the indexing resumes at the first digit of n as many times as necessary to find the substitution digit. Leading zeros are erased unless the result is 0. 1
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 14, 11, 16, 11, 18, 11, 0, 12, 22, 32, 44, 52, 66, 72, 88, 92, 30, 33, 32, 33, 34, 33, 36, 33, 38, 33, 0, 14, 22, 34, 44, 54, 66, 74, 88, 94, 50, 55, 52, 55, 54, 55, 56, 55, 58, 55, 0, 16, 22, 36, 44, 56, 66, 76 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
For all numbers n, the iterated map n -> a(n) gives a loop of numbers linked by permutations of their digits, consisting of k-cycles, with k always odd. Indeed, for k even, each iteration divides k by 2. After a few steps, we obtain a fixed point or a loop of 2, 3, 4 or 6, generated respectively by:
- the identity,
- 2 permutations consisting of one, two or three 3-cycle,
- 3 permutations of 7-cycle,
- 4 permutations of 5-cycle,
- 6 permutations of 9-cycle.
Thus, the smallest numbers n giving such loops are respectively 0, 231, 2345671, 23451 and 234567891. There is no step before loop of 6 because the permutation applies directly to all nonzero digits. Also applicable to other bases, the loop length is the least common multiple of multiplicative orders of 2 modulo the different values of k.
LINKS
EXAMPLE
For n=23, the digit 2 is replaced by three, because it is the second digit of n. Next, the digit 3 cannot be replaced directly because n has no third digit. After counting the first two digits of n, the indexing resumes at the first digit of n which corresponds here to the third ordinal: the digit 3 is thus replaced by two. In summary: a(23) = {2nd digit of n, 1st digit of n} = {3, 2} = 32.
a(2056748) = {0, 0, 7, 4, 8, 6, 2} = 74862.
MATHEMATICA
Array[FromDigits@ Map[# /. k_ /; ! IntegerQ@ k -> 0 &, PadRight[#, 9, #][[#]]] &@ IntegerDigits[#] &, 67] (* Michael De Vlieger, Sep 30 2019 *)
PROG
(PARI) a(n) = {if (n==0, return (0)); my(s = Str(n), d=digits(n)); if (#s < 9, my(i=1); while (#s < 9, s = concat(s, d[i]); i++; if (i>#d, i=1))); my(dm = digits(eval(s))); my(ns=""); for (i=1, #d, if (dm[i], ns = concat(ns, dm[dm[i]]), ns = concat(ns, 0)); ); eval(ns); } \\ Michel Marcus, Sep 30 2019
CROSSREFS
Cf. A002326.
Sequence in context: A305795 A319705 A331746 * A331166 A304232 A357030
KEYWORD
nonn,easy,look,base
AUTHOR
Stéphane Rézel, Sep 29 2019
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 April 23 16:40 EDT 2024. Contains 371916 sequences. (Running on oeis4.)