f=lambda x,y,i=1:i**y%x<1or-~f(x,y,i+1)for i in [[26,2],[96,2],[32,3],[64,9],[27,3]]: print('%s -> %s'%(i,f(*i)))
Standard input is empty
[26, 2] -> 26 [96, 2] -> 24 [32, 3] -> 4 [64, 9] -> 2 [27, 3] -> 3
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!