GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Friday 2 September 2022

[Solution] Madoka and Strange Thoughts Codeforces Solution


A. Madoka and Strange Thoughts
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Madoka is a very strange girl, and therefore she suddenly wondered how many pairs of integers (a,b) exist, where 1a,bn, for which lcm(a,b)gcd(a,b)3.

In this problem, gcd(a,b) denotes the greatest common divisor of the numbers a and b, and lcm(a,b) denotes the smallest common multiple of the numbers a and b.

Input

The input consists of multiple test cases. The first line contains a single integer t (1t104) — the number of test cases. Description of the test cases follows.

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

The first and the only line of each test case contains the integer n (1n108).

Output

For each test case output a single integer — the number of pairs of integers satisfying the condition.


Note

For n=1 there is exactly one pair of numbers — (1,1) and it fits.

For n=2, there are only 4 pairs — (1,1)(1,2)(2,1)(2,2) and they all fit.

For n=3, all 9 pair are suitable, except (2,3) and (3,2), since their lcm is 6, and gcd is 1, which doesn't fit the condition.

No comments:

Post a Comment