While neither method is an efficient way to solve this problem, this is the kind of thing that just works in Haskell:

Prelude> take 10 $ show $ 895447^504922
"7642073264"

when other languages admit defeat:

>> (895447**504922).to_s[0,10]
(irb):3: warning: in a**b, b may be too big
=> "Infinity"