#P2291. K-th Prime Power Exceeding N

    ID: 15566 Type: Default 1000ms 256MiB

K-th Prime Power Exceeding N

K-th Prime Power Exceeding N

Given two integers n and k, your task is to find the k-th smallest number of the form \(a^b\) such that \(a\) and \(b\) are both prime numbers and \(a^b > n\).

In other words, list all numbers that can be expressed as \(a^b\) with prime \(a\) and prime \(b\) and are strictly greater than \(n\), then output the k-th smallest number from this list.

inputFormat

The input consists of a single line containing two integers n and k separated by a space.

  • n: a non-negative integer.
  • k: a positive integer representing the order of the number to find.

outputFormat

Output a single integer, which is the k-th smallest number of the form \(a^b\) that is strictly greater than n.

sample

1 1
4