[seqfan] A092188

Jean-François Alcover jf.alcover at gmail.com
Fri Jun 1 09:28:25 CEST 2012

Hello Seqfans,

My trouble is about sequence A092188.
a(n) = smallest positive integer m such that 2^3^4^5^...^n == m mod n.

I wanted to generate it sans using the algorithm given by Robert Munafo,
and using the equality mod(a^b,m) = mod(a^(mod(b,phi(m)), m)
This way with this Mathematica one-liner:

a[n_] := Fold[ PowerMod[#2, #1, Nest[EulerPhi, n, #2-2]] &, n, Range[n-1,
2, -1]];

Unfortunately it goes wrong for about 10% of the cases
such as a(10)=8 instead of 2
Any help or hint is welcome.


More information about the SeqFan mailing list