**Mr. X** has given a lab task to his students. He has provided them with a pseudo code of a function. Their task is to implement a similar function that will give same output as the following function. Func(n) { ret = 0 for( i = 1; i < n; i++) { if( gcd(i,n) > 1) { ret = ret + i } } return ret } Input: ------ Input starts with an integer **T (1 ≤ T ≤ 1500)**, denoting the number of test cases. Each of the next **T** lines contain an integer **n (1 ≤ n ≤ 1,000,000,000)**. Output: ------- For each integer **n**, print the value of **Func(n)** in a line. Follow the output format of the sample. Sample Input ------------ 3 4 6 9 Sample Output ------------- 2 9 9

Fahim Shahriar Shakkhor

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 2.00 |

Go | 2.00 |

Java | 2.00 |

JavaScript | 2.00 |

Objective-C | 2.00 |

Perl | 2.00 |

PHP | 2.00 |

Python | 2.00 |

Python3 | 2.00 |

Ruby | 2.00 |

VB.Net | 2.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | feodorv | C | 0.02s |

02 | H_alexa | Cpp | 0.04s |

03 | Rajib_119 | Cpp | 0.04s |

04 | AmdSadi | Cpp | 0.05s |

05 | rifat_ikbal007 | Cpp | 0.05s |

06 | mahbubcseju | Cpp | 0.05s |

07 | shahjalalshohag | Cpp14 | 0.05s |

08 | Mubin_BUBT38 | Cpp | 0.05s |

09 | nadim_brur | Cpp | 0.05s |

10 | mash02 | Cpp | 0.06s |

11 | rabbycse | Cpp14 | 0.06s |

12 | kzvd4729 | Cpp14 | 0.06s |

13 | sayedgkm | Cpp | 0.08s |

14 | mobasshir | Cpp | 0.08s |

15 | Old_kernel | Cpp14 | 0.08s |

16 | nahid08 | Cpp | 0.09s |

17 | st3inum | Cpp14 | 0.09s |

18 | Raihanur_R | Cpp | 0.09s |

19 | Bappy | Cpp14 | 0.10s |

20 | liar | Cpp | 0.11s |

21 | Dalgerok | Cpp14 | 0.12s |

22 | PKP_007 | Cpp | 0.12s |

23 | xeon | Cpp14 | 0.12s |

24 | _c_k_r_ | Cpp | 0.13s |

25 | ssavi | Cpp | 0.14s |

26 | fire_tornado | Cpp | 0.15s |

27 | Double_O | Cpp14 | 0.15s |

28 | ksohan | Cpp | 0.22s |

29 | tariqiitju | Cpp14 | 0.37s |

30 | Taran | Cpp14 | 0.38s |

31 | Bruteforcekid | Cpp14 | 0.39s |

32 | snow_man | Cpp14 | 0.39s |

33 | pulak_ict_mbstu | Cpp14 | 0.40s |

34 | simantaturja | Cpp | 0.40s |

35 | shamimjucse | Cpp | 0.40s |

36 | shahadat191 | Cpp14 | 0.41s |

37 | mamun02inf | Cpp14 | 0.46s |

38 | mh755628 | Cpp | 0.48s |

39 | SakibAlamin | Cpp14 | 0.68s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(