close
login
A390033
Number of different digit-cycles that can appear when you repeatedly multiply by a single digit in base n, tracking only the last digit.
1
1, 2, 4, 5, 9, 8, 16, 15, 19, 18, 28, 21, 41, 32, 40, 43, 49, 38, 64, 49, 69, 56, 64, 67, 81, 82, 82, 85, 105, 80, 136, 115, 121, 98, 164, 101, 169, 128, 184, 163, 181, 138, 196, 149, 195, 128, 136, 199, 211, 162, 228, 225, 201, 164, 288, 275, 277, 210, 172
OFFSET
1,2
COMMENTS
Equivalently, the number of limit cycles formed by iterating the map j -> j*k (mod n).
Cycles are distinct if their elements are reached in a distinct order. For example, the cycle (2 4 8 6) is the same as (4 8 6 2), but distinct from (6 8 4 2).
EXAMPLE
For n=10, the a(10) = 18 cycles which occur are
k=1: 10 cycles of fixed points {0}, {1}, ..., {9}.
k=2: 1 cycle {2,4,8,6} and otherwise fixed points already seen.
k=3: 2 cycles {1,3,9,7} and {6,8,4,2}.
k=4: 2 cycles {2,8} and {4,6}.
k=5: only fixed points; no new cycles.
k=6: no new cycles.
k=7: 1 new cycle {7,9,3,1}, and {4,8,6,2} already seen.
k=8: no new cycles, only {6,8,4,2} already seen.
k=9: 2 cycles {1,9}, {7,3}, and {8,2}, {4,6} already seen.
PROG
(PARI)
find(x, S) = for(i=1, #S, S[i]==x && return(i))
digit_cycles(base)={ my(S=[[k] | k<-[0..base-1]], orbit, t); for(k = 2, base-1, for(d=1, base-1, orbit=[t=d]; while(!setsearch(Set(orbit), t = t*k%base), orbit=concat(orbit, t)); t != orbit[1] && orbit = orbit[find(t, orbit) .. -1]; t = find(vecmin(orbit), orbit); t != 1 && orbit = concat(orbit[t .. -1], orbit[1 .. t-1]); S = setunion( S, [orbit] ))); S};
A390033(n)=#digit_cycles(base) \\ M. F. Hasler, Jan 17 2026
CROSSREFS
Sequence in context: A116920 A116919 A270429 * A359878 A270097 A167511
KEYWORD
nonn,base
AUTHOR
Ali Sada, Jan 14 2026
STATUS
approved