OFFSET
1,2
COMMENTS
Let m^^b be m^m^...^m b-times (integer tetration).
For any n, the phase shift of n*10 at height b is defined as the congruence class modulo 10 of the difference between the least significant non-stable digit of (n*10)^^b and the corresponding digit of (n*10)^^(b+1), so the phase shift of n*10 at height 1 is trivially A065881(n).
Thus, assume b = 2 and, for any given tetration base n*10, this sequence represents the congruence classes modulo 10 of the differences between the rightmost non-stable digit of (n*10)^(n*10) and the zero of (n*10)^((n*10)^(n*10)) which occupies the same decimal position (counting from right to the left) as the rightmost nonzero digit of (n*10)^(n*10).
REFERENCES
Marco Ripà, La strana coda della serie n^n^...^n, Trento, UNI Service, Nov 2011. ISBN 978-88-6178-789-6.
LINKS
Marco Ripà, The congruence speed formula, Notes on Number Theory and Discrete Mathematics, 2021, 27(4), 43—61.
Marco Ripà, Congruence speed of tetration bases ending with 0, arXiv:2402.07929 [math.NT], 2024.
Wikipedia, Graham's Number.
Wikipedia, Tetration.
FORMULA
a(n) equals the least significant nonzero digit of n^(n*10).
Let h indicate the least significant digit of n, then
a(n) = 1 if h = 1,9 or (h = 3,7 and n == (0 mod 10));
a(n) = 6 if h = 2,4,6,8;
a(n) = 9 if (h = 3,7 and n is not congruent to 0 modulo 10);
a(n) = 5 if h = 5.
EXAMPLE
a(2) = 6 since 20^20 == 0 (mod 10^20) and 20^20 == 6 (mod 10^21), and trivially 6 - 0 = 6.
PROG
(Python)
# Function to calculate the p-adic valuation
def p_adic_valuation(n, p):
count = 0
while n % p == 0 and n != 0:
n //= p
count += 1
return count
# Function to calculate tetration (tower of powers)
def tetration(base, height, last_digits=50000):
results = [base]
for n in range(1, height):
result = pow(base, results[-1], 10**last_digits) # Only the last last_digits digits
results.append(result)
return results
# Function to find the first non-zero difference and compute modulo 10
def find_difference_mod_10(tetrations):
differences = []
for n in range(len(tetrations) - 1):
string_n = str(tetrations[n]).zfill(50000) # Pad with zeros if needed
string_n_plus_1 = str(tetrations[n+1]).zfill(50000)
# Find the first difference starting from the rightmost digit
for i in range(49999, -1, -1): # From right to left
if string_n[i] != string_n_plus_1[i]:
difference = (int(string_n[i]) - int(string_n_plus_1[i])) % 10
differences.append(difference)
break
return differences
# Function to determine the first hyperexponent based on modulo 5 congruences
def calculate_initial_exponent(a):
mod_5 = a % 5
if mod_5 == 1:
valuation = p_adic_valuation(a - 1, 5)
initial_exponent = valuation + 2
elif mod_5 in [2, 3]:
valuation = p_adic_valuation(a**2 + 1, 5)
initial_exponent = valuation + 2
elif mod_5 == 4:
valuation = p_adic_valuation(a + 1, 5)
initial_exponent = valuation + 2
else:
valuation = p_adic_valuation(a**2 - 1, 2)
initial_exponent = valuation + 1
return initial_exponent
# Main logic
try:
# Ask for the maximum value of n*10
n = int(input("Write the maximum value of n*10: "))
# Validate the input
if n <= 1 or n > 1000:
raise ValueError("Please enter a positive integer between 1 and 1000.")
# Initialize an empty list to store the second digits of the sfasamenti
sfasamenti_second_digits = []
# Loop through bases 10, 20, ..., n*10
for a in range(10, (n * 10) + 1, 10):
# Calculate the initial exponent based on modulo 5 congruence
initial_exponent = calculate_initial_exponent(a)
# Generate tetrations for 30 iterations and the last 500 digits
tetrations = tetration(a, 3, last_digits=50000)
# Find the modulo 10 differences for the 4 required iterations
mod_10_differences = find_difference_mod_10(tetrations[initial_exponent-1:initial_exponent+4])
# Optimization of the output
if mod_10_differences[:2] == mod_10_differences[2:]:
mod_10_differences = mod_10_differences[:2]
if len(set(mod_10_differences)) == 1:
mod_10_differences = [mod_10_differences[0]]
# Append the second digit of the sfasamenti (if it exists) to the list
if len(mod_10_differences) > 1:
sfasamenti_second_digits.append(mod_10_differences[1])
else:
sfasamenti_second_digits.append(mod_10_differences[0])
# Convert the list of second digits into a string
result_str = ', '.join(map(str, sfasamenti_second_digits))
# Print the final output
print(f"The values of the sfasamenti at height 2 of 10 to {n * 10} are: {result_str}")
except Exception as e:
print(f"ERROR!\n{e}")
CROSSREFS
KEYWORD
nonn,base,changed
AUTHOR
Marco Ripà, Oct 06 2024
STATUS
approved