Computer Science, asked by dhanusharumugam, 5 hours ago

Problem
You are given two numbers n and k. For each number in the interval [1, n], your task is to calculate its largest
divisor that is not divisible by k. Print the sum of these divisors.
Note: K is a prime number
Input format
The first line contains an integer T representing the number of test cases that will follow.
Each test case consists of one line containing two integers n and k.
Output format
The output must contain the answer for each test case on a different line.
Each answer consists of a single integer.
Cons
aints
TS300000
1sns1000000000
2sk51000000000
Sample Input
Sample Output
2
10 3
10 2
10 5
1000000000 97
36
43
494897959532893312
Time Limit,1
Memory Line 64
Source me
Explanation
In the first test case, f(x) from 1 to 10 is [1, 2, 1, 4, 5, 2, 7, 8, 1, 10), sum of which is 41
In the second test case, 1(x) from 1 to 10 is [1, 1, 3, 1, 5, 3, 7, 1, 9,5).
In the third test case, f (x) from 1 to 10 is [1, 2, 3, 4, 1,6,7,8,0, 2).

Answers

Answered by JAYASRIG
2

Answer:

sorry I didn't know answer I'll help you in another questio

Similar questions