188 The hyperexponentiation of a number.sf 336 B

123456789101112131415161718192021
  1. #!/usr/bin/ruby
  2. # Author: Daniel "Trizen" Șuteu
  3. # Date: 14 August 2016
  4. # License: GPLv3
  5. # Website: https://github.com/trizen
  6. # Find the last 8 digits of 1777↑↑1855.
  7. # https://projecteuler.net/problem=188
  8. # Runtime: 0.230s
  9. func hyper(n, (1)) { n }
  10. func hyper(n, k) {
  11. expmod(n, hyper(n, k-1), 1e8)
  12. }
  13. say hyper(1777, 1855)