AJ's Code blog

spoj solutions and other codes in python, C , C++

Tuesday, 12 February 2013

GCD (very large numbers)

#Python code to find GCD of two very large numbers

for i in range(input()):
    a,b = [long(i) for i in raw_input().split()]
    while b :
        a,b = b,long(a%b)
    print a
Posted by Coding man at 02:50
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: Python codes

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2014 (3)
    • ►  November (3)
  • ▼  2013 (94)
    • ►  October (4)
    • ▼  February (32)
      • Number to Word
      • Tiling a Grid With Dominoes
      • Househoder Method and Jacobi Rotaion
      • Circular Track
      • Size Contest
      • Tanks
      • H Number
      • Azooz
      • Word To Number
      • Egypt
      • Pizza
      • GCD (very large numbers)
      • Binary GCD
      • GCD2
      • Euler Totient Function
      • Cards
      • Recaman’s Sequence
      • A Game with Numbers
      • Binary Stirling Numbers
      • Armstrong number
      • Ambiguous Permutations
      • Street Parade
      • Sieve of Eratosthenes
      • 28 digits of phi (Golden ratio)
      • 27 digits of e (Euler's number)
      • Lucas number
      • 1 Lac Digits of Pi
      • Cube Root Truncation
      • Heptadecimal Numbers
      • Last Non-Zero Digit of Factorials
      • Tridiagonalization using Given's Method
      • 8057. Square Free Factorization Problem code: AMR10C
    • ►  January (58)

About Me

Coding man
View my complete profile
Simple theme. Powered by Blogger.