Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Give the remainder on division of a power tower expression
ResourceFunction["PowerTowerMod"][expr, n] gives Mod[expr,n] without evaluating the power tower expression expr.  | 
Find the last 20 digits of a power tower:
| In[1]:= | 
| Out[1]= | 
Check:
| In[2]:= | 
| Out[2]= | 
Nested power towers:
| In[3]:= | 
| Out[3]= | 
PoweTowerMod does not evaluate the power tower expression, and so can work with expressions that are much larger than the maximum number:
| In[4]:= | 
| Out[4]= | 
| In[5]:= | 
| Out[5]= | 
For expressions small enough for Mod, PowerTowerMod returns the same result:
| In[6]:= | 
| Out[6]= | 
Using PowerTowerMod:
| In[7]:= | 
| Out[7]= | 
This work is licensed under a Creative Commons Attribution 4.0 International License