Loading Now

superEven2

Let a number be supereven if all of its digits are even, and its digital root is also even.

Here are the first few supereven non-negative integers:

0, 2, 4, 6, 8, 20, 22, 24, 26, 40, ...

Given an integer n, find the nth (1-based) supereven integer.

Example:

  • For n = 7, the output should be superEven2(n) = 22.

    The 7th supereven non-negative integer is 22, since 2 and 2+2=4 are both even.

Input/Output

  • [execution time limit] 0.5 seconds 

  • [input] integer n

    The 1-based index of the superevennumber.

    Constraints:

    1 ≤ n ≤ 105.

  • [output] integer

Post Comment

Contact