login
A342176
Tower of primes modulo n: a(n) = (2^3^5^7^ ... ^prime(n)) mod n.
1
0, 0, 2, 0, 3, 2, 1, 0, 8, 8, 8, 8, 8, 8, 8, 0, 8, 8, 18, 8, 8, 8, 2, 8, 8, 8, 26, 8, 26, 8, 8, 0, 8, 8, 8, 8, 6, 18, 8, 8, 8, 8, 32, 8, 8, 2, 7, 32, 29, 8, 8, 8, 18, 26, 8, 8, 56, 26, 42, 8, 8, 8, 8, 0, 8, 8, 58, 8, 2, 8, 18, 8, 1, 6, 8, 56
OFFSET
1,3
COMMENTS
a(n) = 0 iff n is a power of 2.
EXAMPLE
a(1) = 0 = 2 mod 1. a(2) = 0 = 2^3 mod 2. a(3) = 2 = 2^3^5 = 2^243 = 2 mod 3.
PROG
(PARI) { a(n, m=n, s=2) = local(g); if(s==prime(n), return(n%m)); g=s^valuation(m, s); m\=g; lift(chinese(Mod(0, g), Mod(s, m)^a(n, eulerphi(m), nextprime(s+1)) )) }
CROSSREFS
Cf. A000040.
Sequence in context: A292108 A352910 A362328 * A325195 A026728 A241556
KEYWORD
nonn
AUTHOR
Peter Schorn, Mar 04 2021
STATUS
approved