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.

A245971 Tower of 4s mod n.

This page as a plain text file.
%I A245971 #18 Mar 16 2020 18:24:53
%S A245971 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,
%T A245971 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,
%U A245971 28,24,45,16,57,4,4,0,61,4,55,52,49,46,50,40,37
%N A245971 Tower of 4s mod n.
%C A245971 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).
%H A245971 Wayne VanWeerthuizen, <a href="/A245971/b245971.txt">Table of n, a(n) for n = 1..10000</a>
%o A245971 (Sage)
%o A245971 def tower4mod(n):
%o A245971     if n <= 10:
%o A245971         return 256%n
%o A245971     else:
%o A245971         ep = euler_phi(n)
%o A245971         return power_mod(4,ep+tower4mod(ep),n)
%o A245971 [tower4mod(n) for n in range(1, 30)]
%o A245971 (Haskell)
%o A245971 import Math.NumberTheory.Moduli (powerMod)
%o A245971 a245971 n = powerMod 4 (phi + a245971 phi) n
%o A245971             where phi = a000010 n
%o A245971 -- _Reinhard Zumkeller_, Feb 01 2015
%Y A245971 Cf. A240162, A245970, A245972, A245973, A245974.
%Y A245971 Cf. A000010, A000302.
%K A245971 nonn,easy
%O A245971 1,6
%A A245971 _Wayne VanWeerthuizen_, Aug 08 2014