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.

A245974 Tower of 7's mod n.

Original entry on oeis.org

0, 1, 1, 3, 3, 1, 0, 7, 7, 3, 2, 7, 6, 7, 13, 7, 12, 7, 7, 3, 7, 13, 20, 7, 18, 19, 16, 7, 1, 13, 19, 23, 13, 29, 28, 7, 34, 7, 19, 23, 26, 7, 7, 35, 43, 43, 37, 7, 0, 43, 46, 19, 11, 43, 13, 7, 7, 1, 7, 43, 6, 19, 7, 55, 58, 13, 63, 63, 43, 63, 66, 7, 30
Offset: 1

Views

Author

Wayne VanWeerthuizen, Aug 08 2014

Keywords

Comments

a(n) = (7^(7^(7^(7^(7^ ... ))))) mod n, provided sufficient 7's are in the tower such that adding more doesn't affect the value of a(n).

Examples

			a(2) = 1, as 7^X is odd for any whole number X.
a(11) = 2, as 7^(7^7) == 7^(7^(7^7)) == 7^(7^(7^(7^7))) == 2 (mod 11).
		

Crossrefs

Programs

  • Maple
    A:= proc(n) option remember; 7 &^ A(numtheory:-phi(n)) mod n end proc:
    A(2):= 1;
    seq(A(n), n=2..100);
  • Mathematica
    a[n_] := a[n] = Switch[n, 1, 0, 2, 1, _, 7^a[EulerPhi[n]]]~Mod~n;
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Sep 21 2022 *)
  • Sage
    def a(n):
        if ( n <= 10 ):
            return 823543%n
        else:
            return power_mod(7,a(euler_phi(n)),n)

Formula

a(n) = 7^a(A000010(n)) mod n. For n <= 10, a(n) = (7^7) mod n.