Sum of Powers
Time limit2sMemory limit1024 MB
Find the n-th natural number k such that k divides 1 + 2^k + 3^k + 4^k + 5^k + 6^k, with n up to 65.
- Level
Medium5 of 10
- Topics
- Number theory, Math, Brute force
- Solved
- No attempts yet
Problem
Seryozha loves studying numerical sequences. He has already studied every sequence that appears in books, so he asks all his acquaintances to invent one for him. His younger brother Romochka, who can only count to six, also asks for a sequence. After long explanations from Seryozha about what a sequence is, Romochka suggests that Seryozha study . Seryozha has already studied that sequence many times, so he changed it slightly. Now he studies a sequence of natural numbers in which each term is a divisor of .
The first term of this sequence is , because and 21 is divisible by 1. The number 2 is not in this sequence, because is not divisible by 2. The number 3 is in this sequence, because and 441 is divisible by 3.
Seryozha computed a few terms of the sequence and then decided to write a program that computes the term with number . Write such a program.
Input
The input file contains a single integer ().
Output
Print the term of the sequence with number to the output file.