A091662 Duplicate of A063006.
1, 5, 7, 8, 1, 2, 4, 7, 5, 3, 6, 1, 0, 8, 4, 7, 8, 4, 5, 1, 2, 5, 4, 0, 0, 6, 7, 6, 8, 7, 1, 9, 9, 1, 8
Offset: 0
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
For m = 25, a(23) = 3 implies that 25^^(25 + i) freezes 3*i "new" rightmost digits (i >= 0).
\\ uses reducetower.gp from links f2(x,y) = my(k=0); while(reducetower(x, 10^k, y) == reducetower(x, 10^k, y+1), k++); k; f1(n) = polcoef(x*(x+1)*(x^4-x^3+x^2-x+1)*(x^4+x^3+x^2+x+1) / ((x-1)^2*(x^2+x+1)*(x^6+x^3+1)) + O(x^(n+1)), n, x); \\ A067251 a(n) = my(m=f1(n)); f2(m, m) - f2(m, m-1); lista(nn) = {for (n=2, nn, print1(a(n), ", "););} \\ Michel Marcus, Jan 27 2021
x equals the limit of the (n+1) trailing digits of 4^(5^n): 4^(5^0) = (4), 4^(5^1) = 10(24), 4^(5^2) = 1125899906842(624), ... x = ...0557423423230896109004106619977392256259918212890624.
To calculate c, d, e, f use Mathematica algorithms for a, b and equations: c=a-b, d=1-c, e=b-1, f=a-1.
{a(n)=local(b=4,v=[]); for(k=1, n+1, b=b^5%10^k; v=concat(v,(10*b\10^k))); v[n+1]} \\ Paul D. Hanna, Jul 06 2006
(A091664_vec(n)=Vecrev(digits(lift(chinese(Mod(0,2^n),Mod(-1,5^n))))))(99) \\ M. F. Hasler, Jan 26 2020
To calculate c, d, e, f use Mathematica algorithms for a, b and equations: c=a-b, d=1-c, e=b-1, f=a-1.
a(3) = 1 since 3^^b := 3^3^3^... freezes 1 more rightmost digit for each unit increment of b, starting from b = 2.
def v2(n): count = 0 while n % 2 == 0 and n > 0: n //= 2 count += 1 return count def v5(n): count = 0 while n % 5 == 0 and n > 0: n //= 5 count += 1 return count def V(a): mod_20 = a % 20 mod_10 = a % 10 if mod_20 == 1: return min(v2(a - 1), v5(a - 1)) elif mod_20 == 11: return min(v2(a + 1), v5(a - 1)) elif mod_10 in {2, 8}: return v5(a ** 2 + 1) elif mod_20 in {3, 7}: return min(v2(a + 1), v5(a ** 2 + 1)) elif mod_20 in {13, 17}: return min(v2(a - 1), v5(a ** 2 + 1)) elif mod_10 == 4: return v5(a + 1) elif mod_20 == 5: return v2(a - 1) elif mod_20 == 15: return v2(a + 1) elif mod_10 == 6: return v5(a - 1) elif mod_20 == 9: return min(v2(a - 1), v5(a + 1)) elif mod_20 == 19: return min(v2(a + 1), v5(a + 1)) def generate_sequence(): sequence = [] for a in range(1026): if a == 0 or a == 1: sequence.append(0) elif a % 10 == 0: sequence.append(-1) else: sequence.append(V(a)) return sequence sequence = generate_sequence() print("a(0), a(1), a(2), ..., a(1025) =", ", ".join(map(str, sequence)))
To calculate c, d, e, f use Mathematica algorithms for a, b and equations: c=a-b, d=1-c, e=b-1, f=a-1.
def A(s, n) n.times{|i| m = 10 ** (i + 1) (0..9).each{|j| k = j * m + s if (k ** 2 - k) % (m * 10) == 0 s = k break end } } s end def A091661(n) str = (10 ** (n + 1) + A(5, n) - A(6, n)).to_s.reverse (0..n).map{|i| str[i].to_i} end p A091661(100) # Seiichi Manyama, Jul 31 2017
def A224474(n) : return crt(-1, 1, 2^n, 5^n)
a(3) = 46 since the congruence speed of 3^^b becomes constant starting from height 2 and its value is 0 for b = 1 and 1 for any b >= 2, then (3^3 - 3^(3^3))/10 == 4 (mod 10) while (3^(3^3) - 3^(3^(3^3)))/10^2 == 6 (mod 10).
def A224476(n) : return crt(2^(n-1)-1, 1, 2^n, 5^n)
a(3) = 64 since the congruence speed of 3 at height 3^^(2 + u_5(3^2 + 1)) is constant and its value is 1, so (3^(3^3) - 3^(3^(3^3)))/10^2 == 6 (mod 10) while (3^(3^(3^3)) - 3^(3^(3^(3^3))))/10^3 == 4 (mod 10).
# 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=500): 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(500) # Pad with zeros if needed string_n_plus_1 = str(tetrations[n+1]).zfill(500) # Find the first difference starting from the rightmost digit for i in range(499, -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: a = int(input("Enter a positive integer greater than 1: ")) # Check if the number ends with 0 if a % 10 == 0: print(-1) elif a <= 1: raise ValueError("The number must be greater than 1.") else: # 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, 30, last_digits=500) # 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]] # Convert the list of differences into a string without brackets or commas result_str = ''.join(map(str, mod_10_differences)) # Print the optimized result print(f"a({a}) = {result_str}") except Exception as e: print(f"ERROR!\n{e}")
Comments