Function Repository Resource:

# TetrationMod

Get the mod value of large exponential towers

Contributed by: Trevor Cappallo
 ResourceFunction["TetrationMod"][n,h,m] returns the value of an exponential integer tower of value n and height h, taken mod m.

## Details

All arguments must be positive integers.
h cannot be larger than \$RecursionLimit, but ResourceFunction["TetrationMod"] typically converges at an h value far smaller than that. If necessary for some reason, you can increase your \$RecursionLimit to allow a larger h.

## Examples

### Basic Examples (1)

in standard tetration notation. Find :

 In[1]:=
 Out[1]=

### Scope (1)

TetrationMod allows fast evaluation of large arguments that would not be otherwise possible using Mod or PowerMod:

 In[2]:=
 Out[2]=

### Applications (1)

will not change for all hc, where c is a relatively small constant depending on n and m:

 In[3]:=
 Out[3]=

This means that even infinitely tall power towers have well-defined mod values for a given n, m.

### Neat Examples (2)

Find the last 10 digits of the exponential tower 202120212021, which is 1000 terms high:

 In[4]:=
 Out[4]=

In fact, you can see this will converge after reaching a height of 9:

 In[5]:=
 Out[5]=

Trevor Cappallo

## Version History

• 1.0.0 – 20 September 2021

## Author Notes

Note that h is the primary computational bottleneck, so keeping it small whenever possible is ideal.