from sys import stdin scan = lambda : stdin.readline() def gcd(a,b): if b==0: return a return gcd(b,a%b) while True: num = int(scan()) if num ==0: break sum=0 for i in range(1,num): for j in range(i+1,num+1): sum = sum + gcd(i,j) print(sum)
Subscribe to:
Post Comments (Atom)
-
Let explain one input. a = -202202202202202202 and b =-101.Make partition of a such that the partition is divisible by b. Look 202 is divi...
-
/*** Md. Namzul Hasan Shahjalal University of Science & Technology,Sylhet. hasan08sust@gmail.com ***/ #include<bits/stdc++.h...
-
It will be easy to solve the problem if you know about the Nim game. " Nim has been mathematically solved for any number of initial...
No comments:
Post a Comment