Skip to content

Learning path · Algorithm Foundations

Back to lesson · Direct reasoning

서로소인 수의 개수 구하기

Unrated
한국어

Language

Contribute a translation
Time limit
1000 ms
Memory limit
256 MB
Submissions
0
Correct
0
Solved by
0
AC rate

Statement

자연수 $n$과 $k$가 주어질 때, 1부터 $n$까지의 자연수 중 $k$와 서로소인 수가 몇 개인지 전체 탐색으로 구하시오. 두 수의 최대공약수가 1이면 서로소이다.

Input

첫째 줄에 두 자연수 $n$과 $k$가 공백을 사이에 두고 주어진다. ($1 \le n, k \le 100$)

Output

$k$와 서로소인 수의 개수를 한 줄에 출력한다.

Examples

Sample input 1
10 3
Sample output 1
7
Sample input 2
1 1
Sample output 2
1

Tags

No tags yet