A350588 a(n) is the number of distinct numbers of steps required for the last n digits of integers to repeat themselves by iterating the map m -> m^5.
1, 2, 3, 4, 6, 9, 14, 23, 33, 45, 59, 75, 93, 113, 135, 159, 184, 211, 240, 271, 304, 339, 376, 415, 456, 499, 544, 591, 640, 691, 744, 799, 855, 913, 973, 1035, 1099, 1165, 1233, 1303, 1375, 1449, 1525, 1603, 1683, 1765, 1849, 1935, 2023, 2113, 2205, 2299
Offset: 1
Examples
a(1) = 1. It takes one step to repeat the last digit by iterating the map on an integer. For example, 2^5 = 32 and 9^5 = 59049. Thus, the distinct number of steps for n = 1 is {1} and a(1) = 1. a(2) = 2. It takes 1 or 2 steps for an integer to repeat its last two digits. For example, 24 -> 7962624; 27 -> 14348907 -> 608266787713357709119683992618861307. Thus, a(2) = 2: {1, 2}. a(3) = 3: {1..3}. a(4) = 4: {1..4}. a(5) = 6: {1..6}. a(6) = 9: {1..9}. a(7) = 14: {1..14}. a(8) = 23: {1..23}. a(9) = 33: {1..24, 32..40}. a(10) = 45: {1..25, 32..41, 64..73}. a(11) = 59: {1..26, 32..42, 64..74, 128..138}.
Programs
-
Python
from math import log, ceil def A350588(n): if n <= 8: b, S = 10**n, set() for i in range(b): t, s, T = i, 0, set() while t not in T: T.add(t); t = (t**5)%b; s += 1 S.add(s) return(len(S)) else: return n*n - 3*n - 17 - sum(ceil(log(i, 2)) for i in range(9, n+1))
Formula
For n >= 9, a(n) = a(n-1) + 2*n - 4 - ceiling(log_2 (n)) or a(n) = n^2 - 3*n - 17 - Sum_{i=9..n} ceiling(log_2 (i)).