Find the smallest positive integer that is not divisible by a given integer .
Given a positive integer , consider the sequence of positive multiples of :
Your task is to return the smallest positive integer that does not belong to this sequence.
In other words, find the smallest positive integer that is not divisible by .
Example 1
Input
k = 2
Output
1
Explanation
The multiples of 2 are 2, 4, 6, 8, ... The smallest positive integer that is not a multiple of 2 is 1.
Example 2
Input
k = 5
Output
1
Explanation
The multiples of 5 are 5, 10, 15, 20, ... The smallest positive integer that is not a multiple of 5 is 1.
Example 3
Input
k = 1
Output
2
Explanation
Every positive integer is a multiple of 1, so there is no missing positive integer in the sequence. A practical convention is to return the next integer after the first positive integer, which is 2.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.