For primes q > p, the sequence q^n mod p^n, n = 1,2,3,... seems mysterious. E..g, 2^n mod 3^n is: 1, 1, 3, 1, 19, 25, 11, 161, [next 25 or so terms continue to increase],... [tip o' the hat to OEIS A002380: http://www.research.att.com/~njas/sequences/A002380 ] 5^n mod 2^n is: 1, 1, 5, 1, 21, 9, 45, 225, 225, 357, 761, 1757, 2641,... 5^n mod 3^n is: 2, 7, 17, 58, 209, 316, 5180, 3526, 4508, 22540, 112700, 209206,... All of these (based on only a few terms) appear to be eventually monotonic; 5^n mod 3^n appears to be monotonic, period. Is anything known about this phenomenon? --Dan _____________________________________________________________________ "It don't mean a thing if it ain't got that certain je ne sais quoi." --Peter Schickele