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.

Showing 1-10 of 13 results. Next

A240162 Tower of 3's modulo n.

Original entry on oeis.org

0, 1, 0, 3, 2, 3, 6, 3, 0, 7, 9, 3, 1, 13, 12, 11, 7, 9, 18, 7, 6, 9, 18, 3, 12, 1, 0, 27, 10, 27, 23, 27, 9, 7, 27, 27, 36, 37, 27, 27, 27, 27, 2, 31, 27, 41, 6, 27, 6, 37, 24, 27, 50, 27, 42, 27, 18, 39, 49, 27, 52, 23, 27, 59, 27, 9, 52, 7, 18, 27, 49, 27
Offset: 1

Views

Author

Wayne VanWeerthuizen, Aug 01 2014

Keywords

Comments

a(n) = (3^(3^(3^(3^(3^ ... ))))) mod n, provided sufficient 3's are in the tower such that adding more doesn't affect the value of a(n).
For values of n significantly less than Graham's Number, a(n) is equal to Graham's Number mod n.

Examples

			a(7) = 6. For any natural number X, 3^X is a positive odd multiple of 3. 3^(any positive odd multiple of three) mod 7 is always 6.
a(9) = 0, since 3^(3^X) is divisible by 9 for any natural number X. In our case, X itself is a tower of 3's.
a(100000000) = 64195387, giving the rightmost eight digits of Graham's Number.
From _Robert Munafo_, Apr 19 2020: (Start)
a(1) = 0, because 3 mod 1 = 0.
a(2) = 1, because 3^3 mod 2 = 1.
a(3) = 0, because 3^3^3 mod 3 = 0.
a(4) = 3, because 3^3^3^3 = 3^N for odd N, 3^N = 3 mod 4 for all odd N.
a(5) = 3^3^3^3^3 mod 5, and we should look at the sequence 3^N mod 5. We find that 3^N = 2 mod 5 whenever N = 3 mod 4. As just shown in the a(4) example, 3^3^3^3 = 3 mod 4. (End)
		

Crossrefs

Programs

  • Haskell
    import Math.NumberTheory.Moduli (powerMod)
    a245972 n = powerMod 3 (a245972 $ a000010 n) n
    -- Reinhard Zumkeller, Feb 01 2015
  • Maple
    A:= proc(n) option remember; 3 &^ A(numtheory:-phi(n)) mod n end proc:
    A(2):= 1;
    seq(A(n), n=2..100); # Robert Israel, Aug 01 2014
  • Mathematica
    a[1] = 0; a[n_] := a[n] = PowerMod[3, a[EulerPhi[n]], n]; Array[a, 72] (* Jean-François Alcover, Feb 09 2018 *)
  • Sage
    def A(n):
        if ( n <= 10 ):
            return 27%n
        else:
            return power_mod(3,A(euler_phi(n)),n)
    

Formula

a(n) = 3^a(A000010(n)) mod n. - Robert Israel, Aug 01 2014

A245971 Tower of 4s mod n.

Original entry on oeis.org

0, 0, 1, 0, 1, 4, 4, 0, 4, 6, 4, 4, 9, 4, 1, 0, 1, 4, 9, 16, 4, 4, 3, 16, 21, 22, 13, 4, 24, 16, 4, 0, 4, 18, 11, 4, 34, 28, 22, 16, 37, 4, 41, 4, 31, 26, 17, 16, 11, 46, 1, 48, 47, 40, 26, 32, 28, 24, 45, 16, 57, 4, 4, 0, 61, 4, 55, 52, 49, 46, 50, 40, 37
Offset: 1

Views

Author

Wayne VanWeerthuizen, Aug 08 2014

Keywords

Comments

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

Crossrefs

Programs

  • Haskell
    import Math.NumberTheory.Moduli (powerMod)
    a245971 n = powerMod 4 (phi + a245971 phi) n
                where phi = a000010 n
    -- Reinhard Zumkeller, Feb 01 2015
  • Sage
    def tower4mod(n):
        if n <= 10:
            return 256%n
        else:
            ep = euler_phi(n)
            return power_mod(4,ep+tower4mod(ep),n)
    [tower4mod(n) for n in range(1, 30)]
    

A245972 Tower of 5s mod n.

Original entry on oeis.org

0, 1, 2, 1, 0, 5, 3, 5, 2, 5, 1, 5, 5, 3, 5, 5, 14, 11, 6, 5, 17, 1, 5, 5, 0, 5, 2, 17, 9, 5, 25, 21, 23, 31, 10, 29, 35, 25, 5, 5, 9, 17, 28, 1, 20, 5, 23, 5, 45, 25, 14, 5, 51, 29, 45, 45, 44, 9, 48, 5, 14, 25, 38, 53, 5, 23, 5, 65, 5, 45, 1, 29, 34, 35, 50
Offset: 1

Views

Author

Wayne VanWeerthuizen, Aug 08 2014

Keywords

Comments

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

Examples

			a(2) = 1, as 5^X is odd for any whole number X.
a(19) = 6, as 5^(5^5) == 5^(5^(5^5)) == 5^(5^(5^(5^5))) == 6 (mod 19).
		

Crossrefs

Programs

  • Maple
    A:= proc(n) option remember; 5 &^ A(numtheory:-phi(n)) mod n end proc:
    A(2):= 1;
    seq(A(n), n=2..100);
  • Mathematica
    a[n_] := a[n] = PowerMod[5, If[n <= 18, 5, a[EulerPhi[n]]], n];
    Array[a, 100] (* Jean-François Alcover, Jul 25 2022 *)
  • Sage
    def a(n):
        if ( n <= 18 ):
            return 3125%n
        else:
            return power_mod(5,a(euler_phi(n)),n)

Formula

a(n) = 5^a(A000010(n)) mod n. For n<=18, a(n)=(5^5) mod n.

A245973 Tower of 6s mod n.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 0, 0, 6, 5, 0, 1, 8, 6, 0, 1, 0, 1, 16, 15, 16, 2, 0, 6, 14, 0, 8, 23, 6, 1, 0, 27, 18, 1, 0, 1, 20, 27, 16, 18, 36, 1, 16, 36, 2, 36, 0, 43, 6, 18, 40, 47, 0, 16, 8, 39, 52, 9, 36, 9, 32, 36, 0, 1, 60, 14, 52, 48, 36, 6, 0, 1, 38, 6, 20
Offset: 1

Views

Author

Wayne VanWeerthuizen, Aug 08 2014

Keywords

Comments

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

Crossrefs

Programs

  • Sage
    def tower6mod(n):
        if ( n <= 12 ):
            return 46656%n
        else:
            ep = euler_phi(n)
            return power_mod(6,ep+tower6mod(ep),n)

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.

A256757 Number of iterations of A007733 required to reach 1.

Original entry on oeis.org

0, 1, 2, 1, 2, 2, 3, 1, 3, 2, 3, 2, 3, 3, 2, 1, 2, 3, 4, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 2, 3, 1, 3, 2, 3, 3, 4, 4, 3, 2, 3, 3, 4, 3, 3, 4, 5, 2, 4, 3, 2, 3, 4, 4, 3, 3, 4, 4, 5, 2, 3, 3, 3, 1, 3, 3, 4, 2, 4, 3, 4, 3, 4, 4, 3, 4, 3, 3, 4, 2, 5, 3, 4, 3, 2, 4, 4, 3, 4, 3, 3, 4, 3, 5, 4, 2, 3, 4, 3, 3
Offset: 1

Views

Author

Ivan Neretin, Apr 09 2015

Keywords

Comments

In other words, the minimal height (not counting k) of the power tower 2^(2^(...^(2^k)...)) required to make it eventually constant modulo n (=A245970(n)) for sufficiently large k.
a(n) <= A227944(n) + 1. - Max Alekseyev, Oct 11 2016

Crossrefs

Cf. A007733, A256607 (second iteration), A256758 (positions of records), A003434, A227944 (similarly built upon the totient function).

Programs

  • Haskell
    a256757 n = fst $ until ((== 1) . snd)
                (\(i, x) -> (i + 1, fromIntegral $ a007733 x)) (0, n)
    -- Reinhard Zumkeller, Apr 13 2015
  • Mathematica
    A007733 = Function[n, MultiplicativeOrder[2, n/(2^IntegerExponent[n, 2])]];
    a = Function[n, k = 0; m = n; While[m > 1, m = A007733[m]; k++]; k];
    Table[a[n], {n, 100}] (* Ivan Neretin, Apr 13 2015 *)
  • PARI
    a(n) = {if (n==1, return(0)); nb = 1; while((n = znorder(Mod(2, n/2^valuation(n, 2)))) != 1, nb++); nb;} \\ Michel Marcus, Apr 11 2015
    

Formula

For n>1, a(n) = a(A007733(n)) + 1.

A254411 Limit of f(f(f(...f(0)...))) modulo n as the number of iterations of f(x) = 2^x+1 grows.

Original entry on oeis.org

0, 1, 0, 1, 3, 3, 2, 1, 0, 3, 9, 9, 6, 9, 3, 1, 3, 9, 0, 13, 9, 9, 7, 9, 18, 19, 0, 9, 20, 3, 9, 1, 9, 3, 23, 9, 32, 19, 6, 33, 34, 9, 40, 9, 18, 7, 35, 33, 23, 43, 3, 45, 42, 27, 53, 9, 0, 49, 32, 33, 54, 9, 9, 1, 58, 9, 44, 37, 30, 23, 30, 9, 2, 69, 18, 57, 9, 45, 65, 33, 0, 75, 25, 9, 3, 83, 78, 9, 68, 63, 58, 53, 9, 35, 38, 33, 71, 23, 9, 93
Offset: 1

Views

Author

Max Alekseyev, Jan 30 2015

Keywords

Comments

Also, limit of f(f(f(...f(m)...))) modulo n for any integer m >= 0.

Crossrefs

Programs

  • PARI
    { A254411(m) = my(g); if(m==1, return(0)); g=2^valuation(m,2); m\=g; lift( chinese(Mod(0,g),Mod(2,m)^A254411(eulerphi(m)) ) + 1) }

Formula

a(n) = limit of A254429(m) mod n as m grows.
a(n) = A254429(A227944(n)+k) mod n for any k>=1. In particular, a(n) = A254429(n) mod n.

A254410 Limit of f(f(f(...f(2)...))) modulo n as the number of iterations of f(x) = 2^x - 1 grows.

Original entry on oeis.org

0, 1, 1, 3, 2, 1, 1, 7, 1, 7, 6, 7, 10, 1, 7, 15, 8, 1, 1, 7, 1, 17, 17, 7, 2, 23, 1, 15, 26, 7, 3, 31, 28, 25, 22, 19, 34, 1, 10, 7, 4, 1, 1, 39, 37, 17, 35, 31, 1, 27, 25, 23, 32, 1, 17, 15, 1, 55, 36, 7, 5, 3, 1, 63, 62, 61, 43, 59, 40, 57, 49, 55, 1, 71, 52, 39, 50, 49, 75, 47, 1, 45, 66, 43, 42, 1, 55, 39, 63, 37, 36, 63, 34, 35, 77, 31, 65, 1, 28, 27
Offset: 1

Views

Author

Max Alekseyev, Jan 30 2015

Keywords

Comments

Also, limit of f(f(f(...f(m)...))) modulo n for any integer m >= 2.

Crossrefs

Programs

  • Mathematica
    Clear[a]; Unprotect[Power]; 0^0 = 1; a[1]=0; a[n_] := a[n] = Module[{g, m = n}, g = 2^IntegerExponent[m, 2]; m = Floor[m/g]; Mod[ ChineseRemainder[ {0, Mod[2, m]^a[EulerPhi[m]]}, {g, m}] - 1, n]]; Array[a, 100] (* Jean-François Alcover, Jan 01 2016, adapted from PARI *)
  • PARI
    { A254410(m) = my(g); if(m==1, return(0)); g=2^valuation(m,2); m\=g; lift( chinese(Mod(0,g),Mod(2,m)^A254410(eulerphi(m)) ) - 1) }

Formula

a(n) = limit of A007013(m) mod n as m grows.
a(n) = A007013(A227944(n) + k) mod n for any k >= 1. In particular, a(n) = A007013(n) mod n.

A318623 a(n) = 2^phi(n) mod n.

Original entry on oeis.org

0, 0, 1, 0, 1, 4, 1, 0, 1, 6, 1, 4, 1, 8, 1, 0, 1, 10, 1, 16, 1, 12, 1, 16, 1, 14, 1, 8, 1, 16, 1, 0, 1, 18, 1, 28, 1, 20, 1, 16, 1, 22, 1, 12, 1, 24, 1, 16, 1, 26, 1, 40, 1, 28, 1, 8, 1, 30, 1, 16, 1, 32, 1, 0, 1, 34, 1, 52, 1, 36, 1, 64, 1, 38, 1, 20, 1, 40, 1
Offset: 1

Views

Author

Jianing Song, Aug 30 2018

Keywords

Comments

Of course, a(n) = 0 iff n is a power of 2 and a(n) = 1 iff n is an odd number > 1. For other n, let n = 2^t*s, t > 0, s > 1 is an odd number, then a(n) is the unique solution to x == 0 (mod 2^t) and x == 1 (mod s).

Examples

			a(6) = 2^phi(6) mod 6 = 2^4 mod 6 = 4.
a(18) = 2^phi(18) mod 18 = 2^6 mod 18 = 10.
		

Crossrefs

Programs

  • Magma
    [Modexp(2, EulerPhi(n), n): n in [1..110]]; // Vincenzo Librandi, Aug 02 2018
  • Mathematica
    a[n_] = Mod[2^EulerPhi[n], n]; Array[a, 50] (* Stefano Spezia, Sep 01 2018 *)
    Table[PowerMod[2,EulerPhi[n],n],{n,80}] (* Harvey P. Dale, Nov 07 2021 *)
  • PARI
    a(n) = lift(Mod(2, n)^(eulerphi(n)))
    

Formula

If n is a power of 2 then a(n) = 0; if n is an odd number > 1 then a(n) = 1; else, let n = 2^t*s, t > 0, s > 1 is an odd number, then a(n) = n - (s mod 2^t)^2 + 1.

A318989 Limiting value of A318970(k) mod n as k grows.

Original entry on oeis.org

0, 1, 0, 1, 1, 3, 2, 5, 0, 1, 6, 9, 1, 9, 6, 5, 4, 9, 14, 1, 9, 17, 14, 21, 6, 1, 18, 9, 0, 21, 6, 5, 6, 21, 16, 9, 2, 33, 27, 21, 6, 9, 3, 17, 36, 37, 19, 21, 16, 31, 21, 1, 6, 45, 6, 37, 33, 29, 34, 21, 52, 37, 9, 5, 1, 39, 40, 21, 60, 51, 42, 45, 42, 39, 6, 33, 72, 27, 28, 21, 72, 47, 56, 9, 21, 3, 0, 61, 37, 81, 79, 37, 6, 19, 71, 69, 11, 65, 72, 81
Offset: 1

Views

Author

Max Alekseyev, Sep 06 2018

Keywords

Comments

Is there a prime p in A318971 such that a(p) is nonzero?

Crossrefs

Formula

a(n) = A318970(k) mod n holds for any k >= A227944(n). In particular, a(n) = A318970(A227944(n)) mod n.
Showing 1-10 of 13 results. Next