We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #188: The hyperexponentiation of a number

Project Euler #188: The hyperexponentiation of a number

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 188 from projecteuler.net

The or of a number by a positive integer , denoted by or , is recursively defined by:

,
.

Thus we have e.g. , hence and is roughly .

Find .

Input Format

The first line of each test file contains a single integer which is the number of queries you have to process. lines follow, each containing three integers separated by single spaces: , and .

Constraints


Output Format

Print exactly lines with the corresponding on each line.

Sample Input 0

1
3 3 1000000000000000000

Sample Output 0

7625597484987

Author

bayleef

Difficulty

Expert

Max Score

100

Submitted By

506

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature