Sort by

recency

|

21 Discussions

|

  • + 1 comment
    import math
    import os
    import random
    import re
    import sys
    from functools import reduce
            
        
                            
    
    if __name__ == '__main__':
        first_multiple_input = input().rstrip().split()
    
        n = int(first_multiple_input[0])
    
        k = int(first_multiple_input[1])
    
        A = list(map(int, input().rstrip().split()))
        x=reduce(lambda a,b: math.gcd(a,b),A)
        t=2
        while t<=math.trunc(x**0.5):
            if x%t==0:
                break
            else:
                t+=1
        print(t*(k//t)) if t<=math.trunc(x**0.5) else print(x*(k//x))
    
  • + 0 comments
    import math
    
    def isPrime(n) : 
        # Corner cases 
        if (n <= 1) : 
            return False
        if (n <= 3) : 
            return True
      
        # This is checked so that we can skip  
        # middle five numbers in below loop 
        if (n % 2 == 0 or n % 3 == 0) : 
            return False
      
        i = 5
        while(i * i <= n) : 
            if (n % i == 0 or n % (i + 2) == 0) : 
                return False
            i = i + 6
      
        return True
    
    n,l=map(int, input().split())
    li=list(map(int, input().split()))
    
    else:
     
        if(n==1):
            print(0)
        else:
            abc=li[0]
            for i in range(1,len(li)):
                abc=math.gcd(abc,li[i])
            
            if(l<abc):
                if(isPrime(abc)):
                    print(0)
                else:
                    for i in range(l,1,-1):
                        
                        ans2=math.gcd(i,abc)
                        if(ans2>1):
                            print(l-l%ans2)
                            break
                
            else:
                ans=l%abc
                
            
    
                ans1=l-ans
                print(ans1)
    
  • + 0 comments
    #!/bin/python3
    
    import math
    import os
    import random
    import re
    import sys
    from collections import defaultdict
    def factors(n):
        
        res=defaultdict(int)
        while n&1!=1:
            res[2]+=1
            n//=2
        for i in range(3,int(pow(n,0.5))+1,2):
            while n%i==0:
                res[i]+=1
                n//=i
        if n>2:
            res[n]+=1
        return res
    
    
    if __name__ == '__main__':
        nk = input().split()
    
        n = int(nk[0])
    
        k = int(nk[1])
    
        A = list(map(int, input().rstrip().split()))
        hcf=A[0]
        for i in range(1,n):
            hcf=math.gcd(hcf,A[i])
        factor=factors(hcf).keys()
        M=0
        for x in factor:
            M=max(M,k-k%x)
        print(M)
    
        
        
        
            
    
  • + 0 comments

    Football is my passion, I follow all matches, this applies to American football and ordinary. I recently realized that my passion for this sport can be monetized and bet on matches. In order not to lose money and predict the outcome of the game, I read la liga betting tips . This site was advised to me by a friend of mine who is interested in earning money on bets. This resource has the best and most accurate forecasts, thanks to them I always win.

  • + 2 comments

    Calculate the prime factors of gcd of the given list of elements . Then for each prime factor , Calculate the highest multiple <= k. the result would be the maximum of the above multiples generated.