
kthBoring
A number is considered to be boring if:
- it’s a positive integer;
- it’s not prime;
- it does not belong to the Fibonacci sequence.
Given a number k
, find the kth
boringnumber when counting up from 1
.
Example:
-
For
k = 1
, the output should bekthBoring(k) = 4
.The numbers
1
,2
and3
belong to the Fibonacci sequence, so they are not boring. The number4
is not prime and does not belong to the Fibonacci sequence, so it’s the1
st boringnumber. -
For
k = 2
, the output should bekthBoring(k) = 6
.The number
5
is prime, so it’s not boring, meaning that the2
nd boringnumber is6
.
Input/Output:
-
[execution time limit] 0.5 seconds
-
[input] integer k
1 ≤ k ≤ 2 · 105
. -
[output] integer
Thekth
boring number when counting up from1
.
Post Comment