cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A327886 #26 Jan 17 2021 22:49:25
%S A327886 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,
%T A327886 66,72,88,92,30,33,32,33,34,33,36,33,38,33,0,14,22,34,44,54,66,74,88,
%U A327886 94,50,55,52,55,54,55,56,55,58,55,0,16,22,36,44,56,66,76
%N 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.
%C A327886 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:
%C A327886 - the identity,
%C A327886 - 2 permutations consisting of one, two or three 3-cycle,
%C A327886 - 3 permutations of 7-cycle,
%C A327886 - 4 permutations of 5-cycle,
%C A327886 - 6 permutations of 9-cycle.
%C A327886 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.
%H A327886 Stéphane Rézel, <a href="/A327886/b327886.txt">Table of n, a(n) for n = 0..10000</a>
%e A327886 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.
%e A327886 a(2056748) = {0, 0, 7, 4, 8, 6, 2} = 74862.
%t A327886 Array[FromDigits@ Map[# /. k_ /; ! IntegerQ@ k -> 0 &, PadRight[#, 9, #][[#]]] &@ IntegerDigits[#] &, 67] (* _Michael De Vlieger_, Sep 30 2019 *)
%o A327886 (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
%Y A327886 Cf. A002326.
%K A327886 nonn,easy,look,base
%O A327886 0,3
%A A327886 _Stéphane Rézel_, Sep 29 2019