%I #5 Feb 17 2022 01:11:13
%S 1,2,3,4,6,9,14,23,33,45,59,75,93,113,135,159,184,211,240,271,304,339,
%T 376,415,456,499,544,591,640,691,744,799,855,913,973,1035,1099,1165,
%U 1233,1303,1375,1449,1525,1603,1683,1765,1849,1935,2023,2113,2205,2299
%N 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.
%F 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)).
%e 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.
%e 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}.
%e a(3) = 3: {1..3}.
%e a(4) = 4: {1..4}.
%e a(5) = 6: {1..6}.
%e a(6) = 9: {1..9}.
%e a(7) = 14: {1..14}.
%e a(8) = 23: {1..23}.
%e a(9) = 33: {1..24, 32..40}.
%e a(10) = 45: {1..25, 32..41, 64..73}.
%e a(11) = 59: {1..26, 32..42, 64..74, 128..138}.
%o (Python)
%o from math import log, ceil
%o def A350588(n):
%o if n <= 8:
%o b, S = 10**n, set()
%o for i in range(b):
%o t, s, T = i, 0, set()
%o while t not in T: T.add(t); t = (t**5)%b; s += 1
%o S.add(s)
%o return(len(S))
%o else: return n*n - 3*n - 17 - sum(ceil(log(i, 2)) for i in range(9, n+1))
%Y Cf. A000584, A348338, A348339, A349744.
%K nonn,base
%O 1,2
%A _Ya-Ping Lu_, Jan 07 2022
|