cp's OEIS Frontend

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.

A386005 Number of stable digits of the integer tetration n^^n (i.e., maximum nonnegative integer m such that n^^n is congruent modulo 10^m to n^^(n + 1)), or -1 if n is a multiple of 10.

Original entry on oeis.org

0, 2, 3, 12, 7, 12, 7, 9, -1, 12, 11, 13, 13, 61, 17, 17, 32, 19, -1, 22, 20, 22, 46, 78, 54, 26, 27, 29, -1, 32, 62, 33, 33, 71, 37, 37, 36, 39, -1, 42, 40, 84, 43, 92, 47, 46, 47, 98, -1, 103, 51, 53, 53, 166, 57, 171, 56, 59, -1, 62, 60, 62, 63, 396, 67, 66
Offset: 2

Views

Author

Marco Ripà, Jul 14 2025

Keywords

Comments

If n is divisible by 10, the corresponding a(n) would be too large to be include in the data section (it would be equal to the number of trailing zeros that appear at the end of n^^n).
This sequence directly follows from the constancy of the "congruence speed" property characterizing tetration (for an explicit formula to calculate a(n) for any n not a multiple of 10, see the linked paper entitled "Number of stable digits of any integer tetration").

Examples

			For n = 5, 5^5^5^5^5 is congruent to 5^5^5^5^5^5 (mod 10^12) and 5^5^5^5^5 is not congruent to 5^5^5^5^5^5 (mod 10^13). Thus, a(5) = 12.
		

References

  • Marco Ripà, La strana coda della serie n^n^...^n, Trento, UNI Service, Nov 2011. ISBN 978-88-6178-789-6.

Crossrefs

Programs

  • Python
    def last_k_digits_tetration(base, height, k):
        mod = 10 ** k
        result = base
        for _ in range(height - 1):
            result = pow(base, result, mod)
        return str(result).zfill(k)
    def count_stable_digits(base, k=500):
        try:
            x = last_k_digits_tetration(base, base, k)
            y = last_k_digits_tetration(base, base + 1, k)
            count = 0
            for i in range(1, k + 1):
                if x[-i] == y[-i]:
                    count += 1
                else:
                    break
            return count
        except:
            return -1
    for n in range(2, 101):
        if n % 10 == 0:
            print(f"n = {n}: -1")
        else:
            print(f"n = {n}: {count_stable_digits(n)}")

Formula

If n == 0 (mod 10), then a(n) = -1, and a(n) = A356946(n) otherwise.