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-9 of 9 results.

A245970 Tower of 2's modulo n.

Original entry on oeis.org

0, 0, 1, 0, 1, 4, 2, 0, 7, 6, 9, 4, 3, 2, 1, 0, 1, 16, 5, 16, 16, 20, 6, 16, 11, 16, 7, 16, 25, 16, 2, 0, 31, 18, 16, 16, 9, 24, 16, 16, 18, 16, 4, 20, 16, 6, 17, 16, 23, 36, 1, 16, 28, 34, 31, 16, 43, 54, 48, 16, 22, 2, 16, 0, 16, 64, 17, 52, 52, 16, 3, 16
Offset: 1

Views

Author

Wayne VanWeerthuizen, Aug 08 2014

Keywords

Comments

a(n) = (2^(2^(2^(2^(2^ ... ))))) mod n, provided enough 2's are in the tower so that adding more doesn't affect the value of a(n).
Let b(i) = A014221(i) = (2^(2^(2^(2^(2^ ... ))))), with i 2's. Since gcd(b(i)+1, b(j)+1) = gcd(2^2^b(i-2)+1, 2^2^b(j-2)+1) = gcd(A000215(b(i-2)), A000215(b(j-2))) = 1 for 1 <= i < j, there is no n > 1 such that a(n) = n-1. Since b(i)-1 = 2^2^b(i-2)-1 divides b(j)-1 = 2^2^b(j-2)-1 for 1 <= i < j, a(n) = 1 if and only if n > 1 is a divisor of a number of the form b(i)-1, or if and only if n > 1 is a divisor of a Fermat number (A023394). - Jianing Song, May 16 2024

Examples

			a(5) = 1, as 2^x mod 5 is 1 for x being any even multiple of two and X = 2^(2^(2^...)) is an even multiple of two.
		

References

  • Ilan Vardi, "Computational Recreations in Mathematica," Addison-Wesley Publishing Co., Redwood City, CA, 1991, pages 226-229.

Crossrefs

Programs

  • Haskell
    import Math.NumberTheory.Moduli (powerMod)
    a245970 n = powerMod 2 (phi + a245970 phi) n
                where phi = a000010 n
    -- Reinhard Zumkeller, Feb 01 2015
    
  • Maple
    A:= proc(n)
         local phin,F,L,U;
         phin:= numtheory:-phi(n);
         if phin = 2^ilog2(phin) then
            F:= ifactors(n)[2];
            L:= map(t -> t[1]^t[2],F);
            U:= [seq(`if`(F[i][1]=2,0,1),i=1..nops(F))];
            chrem(U,L);
         else
            2 &^ A(phin) mod n
         fi
    end proc:
    seq(A(n), n=2 .. 100); # Robert Israel, Aug 19 2014
  • Mathematica
    (* Import Mmca coding for "SuperPowerMod" and "LogStar" from text file in A133612 and then *) $RecursionLimit = 2^14; f[n_] := SuperPowerMod[2, 2^n, n] (* 2^^(2^n) (mod n), in Knuth's up-arrow notation *); Array[f, 72]
    (* Second program: *)
    a[n_] := Module[{phin, F, L, U},
       phin = EulerPhi[n];
       If[phin == 2^Floor@Log2[phin],
          F = FactorInteger[n];
          L = Power @@@ F;
          U = Table[If[F[[i, 1]] == 2, 0, 1], {i, 1, Length[F]}];
          ChineseRemainder[U, L],
          (2^a[phin])~Mod~n]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, May 03 2023, after Robert Israel *)
  • PARI
    a(n)=if(n<3, return(0)); my(e=valuation(n,2),k=n>>e); lift(chinese(Mod(2,k)^a(eulerphi(k)), Mod(0,2^e))) \\ Charles R Greathouse IV, Jul 29 2016
  • SageMath
    def tower2mod(n):
        if ( n <= 22 ):
            return 65536%n
        else:
            ep = euler_phi(n)
            return power_mod(2,ep+tower2mod(ep),n)
    

Formula

a(n) = 2^(A000010(n)+a(A000010(n))) mod n.
a(n) = 0 if n is a power of 2.
a(n) = (2^2) mod n, if n < 5.
a(n) = (2^(2^2)) mod n, if n < 11.
a(n) = (2^(2^(2^2))) mod n, if n < 23.
a(n) = (2^(2^(2^(2^2)))) mod n, if n < 47.
a(n) = (2^^k) mod n, if n < A027763(k), where ^^ is Knuth's double-arrow notation.
From Robert Israel, Aug 19 2014: (Start)
If gcd(m,n) = 1, then a(m*n) is the unique k in [0,...,m*n-1] with
k == a(n) mod n and k == a(m) mod m.
a(n) = 1 if n is a Fermat number.
a(n) = 2^a(A000010(n)) mod n if n is not in A003401.
(End)

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.

A152178 Smallest prime factor of G-n, where G is any sufficiently large power tower of 3, e.g., Graham's number.

Original entry on oeis.org

3, 2, 5, 2, 107, 2, 3, 2, 101, 2, 29, 2, 3, 2, 13, 2, 3626257, 2, 3, 2, 7, 2, 5, 2, 3, 2, 1511, 2, 173, 2, 3, 2, 5, 2, 7, 2, 3, 2, 197, 2, 13, 2, 3, 2, 17491, 2, 18540593, 2, 3, 2, 53, 2, 5, 2, 3, 2, 19, 2, 17, 2, 3, 2, 5, 2, 11, 2, 3, 2, 29, 2, 97, 2, 3, 2, 251
Offset: 0

Views

Author

Karl W. Heuer, Nov 28 2008

Keywords

Comments

Least prime p such that A240162(p) == n (mod p). - Jinyuan Wang, Aug 30 2020

Examples

			a(2) = 5 because 3^3^3^... - 2 = 0 (mod 5).
		

Crossrefs

A332054 Tower of 9's modulo n.

Original entry on oeis.org

0, 1, 0, 1, 4, 3, 1, 1, 0, 9, 5, 9, 1, 1, 9, 9, 9, 9, 1, 9, 15, 5, 8, 9, 14, 1, 0, 1, 9, 9, 4, 9, 27, 9, 29, 9, 1, 1, 27, 9, 9, 15, 11, 5, 9, 31, 32, 9, 15, 39, 9, 1, 9, 27, 49, 1, 39, 9, 57, 9, 34, 35, 36, 9, 14, 27, 22, 9, 54, 29, 12, 9, 72, 1, 39, 1, 71, 27
Offset: 1

Views

Author

Jinyuan Wang, Mar 03 2020

Keywords

Comments

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

Crossrefs

Programs

  • PARI
    a(n) = {my(b, c=0, d=n, k=1, x=1); while(k==1, z=x; y=1; b=1; while(z>0, while(y
    				

Formula

a(n) = 9^a(A000010(n)) mod n.
a(n) = (9^^k) mod n, if n < A246497(k), where ^^ is Knuth's double-arrow notation.

A332055 Tower of 8's modulo n.

Original entry on oeis.org

0, 0, 1, 0, 1, 4, 1, 0, 1, 6, 3, 4, 1, 8, 1, 0, 1, 10, 11, 16, 1, 14, 6, 16, 6, 14, 19, 8, 20, 16, 8, 0, 25, 18, 1, 28, 26, 30, 1, 16, 10, 22, 35, 36, 1, 6, 25, 16, 8, 6, 1, 40, 28, 46, 36, 8, 49, 20, 4, 16, 34, 8, 1, 0, 1, 58, 24, 52, 52, 36, 8, 64, 8, 26, 31
Offset: 1

Views

Author

Jinyuan Wang, Mar 04 2020

Keywords

Comments

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

Crossrefs

Programs

  • PARI
    a(n) = {my(b, c=0, d=n, k=1, x=1); while(k==1, z=x; y=1; b=1; while(z>0, while(y
    				

Formula

a(n) = 8^(A000010(n) + a(A000010(n))) mod n.
a(n) = (8^^k) mod n, if n < A246496(k), where ^^ is Knuth's double-arrow notation.

A336111 A non-symmetrical rectangular array read by antidiagonals: A(n,m) is the tower of powers of n modulo m.

Original entry on oeis.org

0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 3, 1, 1, 0, 1, 4, 2, 0, 2, 0, 0, 1, 2, 3, 1, 1, 0, 1, 0, 1, 0, 6, 4, 0, 0, 1, 0, 0, 1, 7, 3, 4, 5, 1, 3, 1, 1, 0, 1, 6, 0, 0, 3, 0, 3, 0, 0, 0, 0, 1, 9, 7, 4, 5, 1, 1, 1, 1, 1, 1, 0, 1, 4, 9, 6, 2, 0, 0, 4, 4, 0, 2, 0, 0
Offset: 1

Views

Author

Jinyuan Wang and Robert G. Wilson v, Apr 15 2020

Keywords

Comments

Although all numbers appear to be present, 1 appears most often followed by 0.
Since the first column and main diagonal are equal to 0, all matrices whose upper left corner is on the main diagonal have as their determinant 0.

Examples

			\m   1  2  3  4  5  6  7  8  9 10 11 12 13  14  15  16 ...
n\
_1   0  1  1  1  1  1  1  1  1  1  1  1  1   1   1   1
_2   0  0  1  0  1  4  2  0  7  6  9  4  3   2   1   0
_3   0  1  0  3  2  3  6  3  0  7  9  3  1  13  12  11
_4   0  0  1  0  1  4  4  0  4  6  4  4  9   4   1   0
_5   0  1  2  1  0  5  3  5  2  5  1  5  5   3   5   5
_6   0  0  0  0  1  0  1  0  0  6  5  0  1   8   6   0
_7   0  1  1  3  3  1  0  7  7  3  2  7  6   7  13   7
_8   0  0  1  0  1  4  1  0  1  6  3  4  1   8   1   0
_9   0  1  0  1  4  3  1  1  0  9  5  9  1   1   9   9
10   0  0  1  0  0  4  4  0  1  0  1  4  3   4  10   0
etc, .
		

References

  • Ilan Vardi, "Computational Recreations in Mathematica," Addison-Wesley Publishing Co., Redwood City, CA, 1991, pages 226-229.

Crossrefs

Programs

  • Mathematica
    (* first load all lines of Super Power Mod by Ilan Vardi from the hyper-link *)
    Table[ SuperPowerMod[n - m + 1, 2^100, m], {n, 14}, {m, n, 1, -1}] // Flatten (* or *)
    a[b_, 1] = 0; a[b_, n_] := PowerMod[b, If[OddQ@ b, a[b, EulerPhi[n]], EulerPhi[n] + a[b, EulerPhi[n]]], n]; Table[a[b - m + 1, m], {b, 14}, {m, b, 1, -1}] // Flatten
Showing 1-9 of 9 results.