OFFSET
2,2
COMMENTS
For any integer n > 1 not a multiple of 10, a(n) belongs to the set {1, 2, 4}. Furthermore, if the last digit of n is 5, then A376446(n) = 5 so that a(n) = 1. Conversely, by definition, a(n) -1 if and only if n is congruent to 0 modulo 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à, On the constant congruence speed of tetration, Notes on Number Theory and Discrete Mathematics, Volume 26, 2020, Number 3, Pages 245-260.
Marco Ripà, The congruence speed formula, Notes on Number Theory and DiscreteMathematics, 2021, 27(4), 43-61.
Marco Ripà and Luca Onnis, Number of stable digits of any integer tetration, Notes on Number Theory and Discrete Mathematics, 2022, 28(3), 441-457.
Wikipedia, Tetration.
FORMULA
EXAMPLE
a(4) = 4 since A376446(4) = 2486 is a 4 digit number.
PROG
(Python)
def p_adic_valuation(n, p):
count = 0
while n % p == 0 and n != 0:
n //= p
count += 1
return count
def tetration(base, height, last_digits=500):
results = [base]
for n in range(1, height):
result = pow(base, results[-1], 10**last_digits)
results.append(result)
return results
def find_difference_mod_10(tetrations):
differences = []
for n in range(len(tetrations) - 1):
string_n = str(tetrations[n]).zfill(500)
string_n_plus_1 = str(tetrations[n+1]).zfill(500)
for i in range(499, -1, -1):
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
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
try:
a = int(input("Write a tetration base (between 2 and 100): "))
if a < 2 or a > 100:
raise ValueError("The base must be between 2 and 100.")
if a % 10 == 0:
print("-1 (since the Asymptotic phase shift is only defined for n not a multiple of 10)")
else:
initial_exponent = calculate_initial_exponent(a)
tetrations = tetration(a, 30, last_digits=500)
mod_10_differences = find_difference_mod_10(tetrations[initial_exponent-1:initial_exponent+4])
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]]
result_str = ''.join(map(str, mod_10_differences))
print(f"Number of digits of the Asymptotic phase shift of n: {len(result_str)}")
except Exception as e:
print(f"ERROR!\n{e}")
CROSSREFS
KEYWORD
sign,base
AUTHOR
Marco Ripà, Oct 17 2024
STATUS
approved