All Tracks Math Problem

Prime
Tag(s):

Very-Easy

Problem
Editorial
Analytics

Tecnoesis, the techical festival of NIT Silchar is coming and thus Arun,Takle and Handi the core-cordinator of departmental team of CSE, decided to conduct a game. In this game, the participant will be given a whole number N and will be asked questions.


q = the sum of prime divisors of N.
p = the sum of numbers of numbers that are coprime and less than or equal to prime divisors of N .
s= the number of prime divisors of N
Constraints:
1<=T<=10^6
0<=N<=10^6
0<=K<=10^6

As it will be very difficult for Arun,Takle and Handi to tell manually whether the answer given by participant is
correct or not. So, they decided to write a code for it. As Arun is very busy in Tecnoesis preparations and Handi
is busy with his GirlFriend, they have given this task to you.

The first line of the input will consist of a single integer T. The next T lines contains 2 integers N and K, denoting the numbers.

OUTPUT
For each test case output a single integer (one per line) M i.e. (N+K+q-p-s).
Input:
2
24 2
8 2

Output:
26
10

Problem Setter : Avinash Gurjar

SAMPLE INPUT
2
24 2
8 2
SAMPLE OUTPUT
26
10
Explanation

In sample :
Divisors for 24 = {1,2,3,4,6,8,12,24}
prime divisors are ={2,3}
q=2+3=5;
k1=number of numbers that are coprime to prime divisor 2 and less than or equal to 2 = 1
k2=number of numbers that are coprime to prime divisor 3 and less than or equal to 3 = 2
p=k1+k2;
p=1+2=3;
number of prime divisors of 24=2 i.e 2 and 3
s=2;

required solution = N+K+q-p-s=24+2+5-2-3=26

Time Limit: 5.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala 2.11.8, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications