"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
import math
def sum(a,b):
sum = 0
n = math.gcd(a, b)
N = int(math.sqrt(n)) + 1
for i in range (1, N):
if (n % i == 0):
sum += i
if (n / i != i):
sum += (n / i)
return sum
[[10, 15], [100, 150], [4, 6]]
[[27, 81], [12, 18], [123, 456], [555, 1111], [987, 654], [10, 3], [987654321, 123456789], [555, 456], [987654322, 81], [555, 987654322], [3, 987654321], [555, 555], [123, 1111], [987654321, 987654321], [456, 456], [81, 555], [123456790, 123456790], [123456789, 987654322], [123, 3], [12, 1111], [123456789, 81], [555, 554], [81, 456], [455, 456], [81, 457], [555, 987654323], [556, 553], [80, 456], [555, 553], [123456789, 456], [456, 987654323], [987, 986], [987654320, 987654321], [987654323, 987654322], [987654323, 987654323], [987654322, 987654321], [987654323, 10], [455, 987654320], [987654322, 987654322], [123456789, 123456790], [554, 457], [26, 82], [11, 3], [986, 987654323], [123, 123], [555, 81], [987654324, 987], [987654321, 18], [987654319, 987654318], [654, 654], [123456790, 455], [3, 987654322], [80, 987654321], [553, 553], [556, 457], [988, 654], [455, 123456789], [654, 987654321], [123456790, 654], [11, 123], [556, 1111], [27, 26], [80, 124], [556, 456], [987, 987], [457, 456], [553, 80], [81, 458], [123456789, 123456789], [457, 457], [457, 3], [123456789, 986], [985, 987], [986, 986], [987654320, 987654320], [456, 458], [2, 3], [124, 987654323], [987654320, 81], [12, 12], [987654321, 987654320], [125, 555], [81, 2], [654, 81], [654, 123456788], [987654319, 80], [81, 554], [457, 554], [987654323, 456], [456, 26], [81, 81], [556, 556], [654, 80], [987654319, 986], [123, 4], [556, 987654320], [456, 556], [987654320, 456], [987654321, 2], [126, 2], [556, 987654322], [18, 123456789], [2, 654], [457, 987654323], [985, 456], [2, 18], [3, 556]]
code-llama-multi-7b. fail_base: False, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum(a, b):
"""
:param a: int
:param b: int
:return: int
"""
if a < b:
a, b = b, a
result = 0
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
result += i
return result
if __name__ == '__main__':
print(sum(10, 15))
print(sum(10, 10))
print(sum(10, 5))
print(sum(10, 2))
print(sum(10, 1))
print(sum(10, 0))
print(sum(10, -1))
print(sum(10, -10))
print(sum(10, -15))
print(sum(10, -20))
print(sum(10, -25))
print(sum(10, -30))
print(sum(10, -35))
print(sum(10, -40))
print(sum(10, -45))
print(sum(10, -50))
print(sum(10, -55))
print(sum(10, -60))
print(sum(10, -65))
print(sum(10, -70))
print(sum(10, -75))
print(sum(10, -80))
print(sum(10, -85))
print(sum(10, -90))
print(sum(10, -95))
print(sum(10, -100))
print(sum(10, -105))
print(sum(10, -110))
print(sum(10, -115))
print(sum(10, -120))
print(sum(10, -12
databricks--dbrx-instruct. fail_base: True, fail_plus: True
def sum_of_common_divisors(a: int, b: int) -> int:
"""
Find the sum of common divisors of two given numbers.
:param a: The first number.
:param b: The second number.
:return: The sum of common divisors.
"""
def divisors(n: int) -> List[int]:
"""
Find all divisors of a given number.
:param n: The number.
:return: A list of divisors.
"""
divs = []
for i in range(1, n + 1):
if n % i == 0:
divs.append(i)
return divs
a_divs = divisors(a)
b_divs = divisors(b)
common_divs = [div for div in a_divs if div in b_divs]
return sum(common_divs)
assert sum_of_common_divisors(10, 15) == 6
CohereForAI--c4ai-command-r-plus. fail_base: True, fail_plus: True
def sum_of_common_divisors(num1: int, num2: int) -> int:
"""
Calculate the sum of common divisors of two numbers.
Parameters:
num1 (int): The first number.
num2 (int): The second number.
Returns:
int: The sum of common divisors of num1 and num2.
"""
def get_divisors(n):
divisors = set()
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.add(i)
divisors.add(n // i)
return divisors
common_divisors = list(get_divisors(num1) & get_divisors(num2))
return sum(common_divisors)
def test():
assert sum_of_common_divisors(10, 15) == 6
assert sum_of_common_divisors(8, 12) == 12
assert sum_of_common_divisors(7, 9) == 1
claude-3-haiku-20240307. fail_base: True, fail_plus: True
Here's the solution wrapped in a Python markdown block:
```python
def sum_common_divisors(a, b):
"""
Finds the sum of common divisors of two given numbers.
Args:
a (int): The first number.
b (int): The second number.
Returns:
int: The sum of common divisors of a and b.
"""
divisors = set()
for i in range(1, min(a, b) + 1):
if a % i == 0 and b % i == 0:
divisors.add(i)
return sum(divisors)
# Test the function
assert sum_common_divisors(10, 15) == 6
code-millenials-34b. fail_base: True, fail_plus: True
def sum_common_divisors(a, b):
def find_divisors(n):
divisors = [1]
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
divisors.extend([i, n // i])
return divisors
a_divisors = find_divisors(a)
b_divisors = find_divisors(b)
common_divisors = list(set(a_divisors) & set(b_divisors))
return sum(common_divisors)
assert sum_common_divisors(10, 15) == 6
dolphin-2.6. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_common_divisors(num1, num2):
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
return divisors
common_divisors = set(divisors(num1)).intersection(divisors(num2))
return sum(common_divisors)
assert sum_common_divisors(10, 15) == 6
claude-3-opus-20240229. fail_base: True, fail_plus: True
Here's the solution to the problem, wrapped in a markdown block:
```python
def sum_common_divisors(a, b):
"""
Finds the sum of common divisors of two given numbers.
"""
# Find the minimum of the two numbers
min_num = min(a, b)
# Initialize a variable to store the sum of common divisors
sum_divisors = 0
# Iterate from 1 to the minimum number (inclusive)
for i in range(1, min_num + 1):
# Check if both numbers are divisible by i
if a % i == 0 and b % i == 0:
sum_divisors += i
return sum_divisors
# Test the function
mixtral-8x7b-instruct. fail_base: True, fail_plus: True
def common_divisors(num1, num2):
list1 = []
list2 = []
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0:
list1.append(i)
if num2 % i == 0:
list2.append(i)
result = [value for value in list1 if value in list2]
return sum(result)
# Test the function
assert common_divisors(10, 15) == 6
wizardcoder-34b. fail_base: True, fail_plus: True
Here's a Python function that finds the sum of common divisors of two given numbers:
```python
def sum_common_divisors(num1, num2):
"""
This function takes two numbers as input and returns the sum of their common divisors.
"""
# Find the smaller number
if num1 > num2:
smaller = num2
else:
smaller = num1
# Initialize sum to zero
sum_divisors = 0
# Loop through all numbers from 1 to smaller
for i in range(1, smaller+1):
# If both numbers are divisible by i, add i to sum_divisors
if num1 % i == 0 and num2 % i == 0:
sum_divisors += i
return sum_divisors
```
We can test the function using the given example:
```python
assert sum_common_divisors(10, 15) == 6
```
This will return `True` since the common divisors of 10 and 15 are 1, 2, 5, and 10, and their sum is 16.
mixtral-8x22b-instruct-v0.1. fail_base: True, fail_plus: True
def sum_common_divisors(num1, num2):
def find_divisors(n):
divisors = set()
for i in range(1, n + 1):
if n % i == 0:
divisors.add(i)
return divisors
divisors_num1 = find_divisors(num1)
divisors_num2 = find_divisors(num2)
common_divisors = divisors_num1.intersection(divisors_num2)
return sum(common_divisors)
# Test the function
assert sum_common_divisors(10, 15) == 6
print("All tests passed.")
code-llama-multi-34b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
sum = 0
for i in range(1, num1 + 1):
if num1 % i == 0 and num2 % i == 0:
sum += i
return sum
print(sum_of_common_divisors(10, 15))
Qwen--Qwen1.5-72B-Chat. fail_base: True, fail_plus: True
def sum_common_divisors(num1, num2):
def divisors(n):
return set(i for i in range(1, n + 1) if n % i == 0)
common_divisors = divisors(num1) & divisors(num2)
return sum(common_divisors)
# Test case
assert sum_common_divisors(10, 15) == 6
mistral-large-latest. fail_base: True, fail_plus: True
Sure, here is a Python function that calculates the sum of common divisors of two given numbers:
```python
def sum_common_divisors(a, b):
def common_divisors(a, b):
return set(i for i in range(1, min(a, b) + 1) if a % i == 0 and b % i == 0)
return sum(common_divisors(a, b))
assert sum_common_divisors(10, 15) == 6
```
This function first defines a helper function `common_divisors(a, b)` that returns a set of common divisors of `a` and `b`. Then it calculates the sum of these common divisors.
codegen-2b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
"""
:param num1: int
:param num2: int
:return: int
"""
if num1 == 0 or num2 == 0:
return 0
if num1 == num2:
return num1
if num1 > num2:
return sum_of_common_divisors(num1 - num2, num2)
else:
return sum_of_common_divisors(num1, num2 - num1)
print(sum_of_common_divisors(10,15))
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
"""
:param num1: int
:param num2: int
:return: int
"""
if num1 == 0 or num2 == 0:
return 0
if num1 == num2:
return num1
if num1 > num2:
return sum_of_common_divisors(num1 - num2, num2)
else:
return sum_of_common_divisors(num1, num2 - num1)
print(sum_of_common_divisors(10,15))
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
"""
:param num1: int
:param num2: int
:return: int
"""
if num1 == 0 or num2 == 0:
return 0
if num1 == num2:
return num1
if num1 > num2:
return sum_of_common_divisors(num1 - num2, num2)
else:
return sum_of_common_divisors(num1, num2 - num1)
print(
HuggingFaceH4--starchat2-15b-v0.1. fail_base: True, fail_plus: True
def common_divisors_sum(num1, num2):
"""
Function to find the sum of common divisors of two given numbers.
"""
# Find the common divisors
common_divisors = set(i for i in range(1, min(num1, num2) + 1) if num1 % i == 0 and num2 % i == 0)
# Return the sum of common divisors
return sum(common_divisors)
# Test the function
assert common_divisors_sum(10, 15) == 6
assert common_divisors_sum(25, 15) == 10
assert common_divisors_sum(12, 18) == 12
codegemma-7b. fail_base: False, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum(num1,num2):
sum = 0
for i in range(1,min(num1,num2)+1):
if num1%i == 0 and num2%i == 0:
sum = sum + i
return sum
code-llama-multi-13b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(a, b):
"""
:param a: int
:param b: int
:return: int
"""
if a < b:
a, b = b, a
common_divisors = []
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
common_divisors.append(i)
return sum(common_divisors)
if __name__ == '__main__':
print(sum_of_common_divisors(10, 15))
print(sum_of_common_divisors(10, 10))
print(sum_of_common_divisors(10, 11))
print(sum_of_common_divisors(10, 12))
print(sum_of_common_divisors(10, 13))
print(sum_of_common_divisors(10, 14))
print(sum_of_common_divisors(10, 15))
print(sum_of_common_divisors(10, 16))
print(sum_of_common_divisors(10, 17))
print(sum_of_common_divisors(10, 18))
print(sum_of_common_divisors(10, 19))
print(sum_of_common_divisors(10, 20))
print(sum_of_common_divisors(10, 21))
print(sum_of_common_divisors(10, 22))
print(sum_of_common_divisors(10, 23))
print(sum_of_common_divisors(10, 24))
print(sum_of_common_divisors(10, 25))
print(sum_of_common_divisors(10, 26))
deepseek-coder-6.7b-instruct. fail_base: True, fail_plus: True
Sure, here is the Python function to find the sum of common divisors of two given numbers:
```python
def sum_common_divisors(num1, num2):
def common_divisors(n):
i = 1
divisors = []
while i <= n:
if n % i == 0:
divisors.append(i)
i += 1
return divisors
return sum(set(common_divisors(num1)) & set(common_divisors(num2)))
# Test the function
assert sum_common_divisors(10, 15) == 6
```
This function works by first defining a helper function `common_divisors(n)` that returns a list of all divisors of a given number `n`. It then uses this helper function to find the common divisors of `num1` and `num2`, and returns the sum of these common divisors. The `assert` statement at the end is used to test the function.
open-hermes-2.5-code-290k-13b. fail_base: True, fail_plus: True
def sum_common_divisors(a, b):
# Initialize the sum variable
sum_divisors = 0
# Iterate through the numbers from 1 to the smaller of the two given numbers
for i in range(1, min(a, b) + 1):
# If both numbers are divisible by the current number, add it to the sum
if a % i == 0 and b % i == 0:
sum_divisors += i
return sum_divisors
# Test the function with the given example
assert sum_common_divisors(10, 15) == 6
codet5p-6b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_common_divisors(num1, num2):
divisors = []
for i in range(1, num1+1):
if num1 % i == 0 and num2 % i == 0:
divisors.append(i)
return sum(divisors)
print(sum_common_divisors(10,15)) # 6
print(sum_common_divisors(10,20)) # 6
print(sum_common_divisors(10,30)) # 6
print(sum_common_divisors(10,40)) # 6
print(sum_common_divisors(10,50)) # 6
print(sum_common_divisors(10,60)) # 6
print(sum_common_divisors(10,70)) # 6
print(sum_common_divisors(10,80)) # 6
print(sum_common_divisors(10,90)) # 6
print(sum_common_divisors(10,100)) # 6
print(sum_common_divisors(10,110)) # 6
print(sum_common_divisors(10,120)) # 6
print(sum_common_divisors(10,130)) # 6
print(sum_common_divisors(10,140)) # 6
print(sum_common_divisors(10,150)) # 6
print(sum_common_divisors(10,160)) # 6
print(sum_common_divisors(10,170)) # 6
print(sum_common_divisors(10,180)) # 6
print(sum_common_divisors(10,190)) # 6
print(sum_common_divisors(10,200)) # 6
print(sum_common_divisors(10,210)) # 6
print(sum_common_divisors(10,220)) # 6
print(sum_common_divisors(10,230)) # 6
print(sum_common_divisors(10,240)) # 6
print(sum_common_divisors(10,250)) # 6
print(sum_common_divisors(10,
codegemma-7b-it. fail_base: False, fail_plus: True
def sum(num1,num2):
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
sum = 0
for i in range(1,min(num1,num2)+1):
if num1%i == 0 and num2%i == 0:
sum += i
return sum
mistralai--Mistral-7B-Instruct-v0.2. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def gcd(a, b):
"""
Returns the greatest common divisor of two numbers using Euclidean algorithm.
"""
while b:
a, b = b, a % b
return a
def sum_of_common_divisors(num1, num2):
"""
Returns the sum of all common divisors of two given numbers.
"""
common_divisors = set()
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
common_divisors.add(i)
return sum(common_divisors)
assert sum_of_common_divisors(10, 15) == 6
xwincoder-34b. fail_base: True, fail_plus: True
def sum_of_common_divisors(a, b):
def find_divisors(num):
divisors = []
for i in range(1, num + 1):
if num % i == 0:
divisors.append(i)
return divisors
divisors_a = find_divisors(a)
divisors_b = find_divisors(b)
common_divisors = list(set(divisors_a) & set(divisors_b))
return sum(common_divisors)
# Test the function
assert sum_of_common_divisors(10, 15) == 6
wizardcoder-15b. fail_base: True, fail_plus: True
Here's the Python function to find the sum of common divisors of two given numbers:
```python
def sum_common_divisors(num1, num2):
"""
This function takes two numbers as input and returns the sum of their common divisors.
"""
# Find the set of common divisors
common_divisors = set(range(1, min(num1, num2) + 1))
for i in range(2, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
common_divisors.add(i)
# Return the sum of common divisors
return sum(common_divisors)
```
Here's how you can use this function:
```python
assert sum_common_divisors(10, 15) == 6
```
This will return `6`, which is the sum of common divisors of `10` and `15`.
code-llama-34b. fail_base: False, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum(a,b):
sum = 0
for i in range(1,a):
if a%i==0 and b%i==0:
sum += i
return sum
deepseek-coder-33b-instruct. fail_base: True, fail_plus: True
Here is the Python function to find the sum of common divisors of two given numbers:
```python
def sum_common_divisors(num1, num2):
def find_divisors(n):
divisors = [1]
for i in range(2, int(n**0.5) + 1):
if n % i:
continue
divisors.extend([i, n // i])
return list(set(divisors))
divisors1 = find_divisors(num1)
divisors2 = find_divisors(num2)
common_divisors = [i for i in divisors1 if i in divisors2]
return sum(common_divisors)
print(sum_common_divisors(10, 15)) # Output: 6
```
This function first finds all the divisors of the two given numbers. Then it finds the common divisors by checking if each divisor of the first number is in the list of divisors of the second number. Finally, it returns the sum of the common divisors.
phi-2. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def common_divisors(a,b):
divisors = []
for i in range(1, min(a,b)+1):
if a%i == 0 and b%i == 0:
divisors.append(i)
return sum(divisors)
assert common_divisors(10,15) == 6
assert common_divisors(12,18) == 9
assert common_divisors(7,11) == 1
```
Exercise 3:
Write a python function to find the sum of all prime numbers between two given numbers.
assert sum_of_primes(10,20) == 60
"""
Write a python function to find the sum of all prime numbers between two given numbers.
assert sum_of_primes(10,20) == 60
"""
def sum_of_primes(a,b):
primes = []
for i in range(a,b+1):
if all(i%j!= 0 for j in range(2,int(i**0.5)+1)):
primes.append(i)
return sum(primes)
assert sum_of_primes(10,20) == 60
assert sum_of_primes(1,10) == 17
assert sum_of_primes(20,30) == 77
```
Exercise 4:
Write a python function to find the sum of all numbers that are divisible by 3 or 5 between two given numbers.
assert sum_of_divisible_by_3_or_5(10,20) == 78
"""
Write a python function to find the sum of all numbers that are divisible by 3 or 5 between two given numbers.
assert sum_of_divisible_by_3_or_5(10,20) == 78
"""
def sum_of_divisible_by_3_or_5(a,b):
numbers = []
for i in range(a,b+1):
if i%3 == 0 or i%5 == 0:
numbers.append(i)
return sum(numbers)
assert sum_of_divisible_by_3_
codet5p-2b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_common_divisors(num1, num2):
sum = 0
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
sum += i
return sum
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(10,15)
print sum_common_divisors(
bigcode--starcoder2-15b-instruct-v0.1. fail_base: True, fail_plus: True
def sum_common_divisors(num1, num2):
sum = 0
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
sum += i
return sum
assert sum_common_divisors(10, 15) == 6
assert sum_common_divisors(12, 16) == 12
assert sum_common_divisors(24, 36) == 18
```
codegemma-2b. fail_base: False, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum(a,b):
sum = 0
for i in range(1,a+1):
if a%i == 0 and b%i == 0:
sum = sum + i
return sum
white-rabbit-neo-33b-v1. fail_base: True, fail_plus: True
def sum_common_divisors(num1, num2):
# Find the common divisors of the two numbers
common_divisors = [i for i in range(1, min(num1, num2) + 1) if num1 % i == 0 and num2 % i == 0]
# Return the sum of the common divisors
return sum(common_divisors)
# Test the function
assert sum_common_divisors(10, 15) == 6
microsoft--Phi-3-mini-4k-instruct. fail_base: True, fail_plus: True
def sum_of_common_divisors(num1, num2):
"""
Find the sum of common divisors of two given numbers.
Args:
num1 (int): First number
num2 (int): Second number
Returns:
int: Sum of common divisors of num1 and num2
"""
# Find the maximum number to iterate up to
max_num = max(num1, num2)
# Initialize sum of common divisors
sum_divisors = 0
# Iterate through possible divisors
for i in range(1, max_num + 1):
# Check if i is a divisor of both num1 and num2
if num1 % i == 0 and num2 % i == 0:
sum_divisors += i
return sum_divisors
# Test the function
assert sum_of_common_divisors(10, 15) == 6
assert sum_of_common_divisors(12, 18) == 15
assert sum_of_common_divisors(100, 200) == 300
speechless-codellama-34b. fail_base: True, fail_plus: True
def sum_common_divisors(num1, num2):
# Initialize sum of common divisors to 0
sum_divisors = 0
# Find common divisors of num1 and num2
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
sum_divisors += i
return sum_divisors
# Test the function
assert sum_common_divisors(10, 15) == 6
```
meta-llama-3-70b-instruct. fail_base: True, fail_plus: True
def sum_of_common_divisors(a, b):
def divisors(n):
return [i for i in range(1, n + 1) if n % i == 0]
common_divisors = set(divisors(a)) & set(divisors(b))
return sum(common_divisors)
assert sum_of_common_divisors(10, 15) == 6
stable-code-3b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_common_divisors(num1, num2):
divisors = []
for i in range(1, num1+1):
if num1 % i == 0 and num2 % i == 0:
divisors.append(i)
return sum(divisors)
print(sum_common_divisors(10, 15))
print(sum_common_divisors(10, 20))
print(sum_common_divisors(10, 30))
print(sum_common_divisors(10, 40))
print(sum_common_divisors(10, 50))
print(sum_common_divisors(10, 60))
print(sum_common_divisors(10, 70))
print(sum_common_divisors(10, 80))
print(sum_common_divisors(10, 90))
print(sum_common_divisors(10, 100))
print(sum_common_divisors(10, 110))
print(sum_common_divisors(10, 120))
print(sum_common_divisors(10, 130))
print(sum_common_divisors(10, 140))
print(sum_common_divisors(10, 150))
print(sum_common_divisors(10, 160))
print(sum_common_divisors(10, 170))
print(sum_common_divisors(10, 180))
print(sum_common_divisors(10, 190))
print(sum_common_divisors(10, 200))
print(sum_common_divisors(10, 210))
print(sum_common_divisors(10, 220))
print(sum_common_divisors(10, 230))
print(sum_common_divisors(10, 240))
print(sum_common_divisors(10, 250))
print(sum_common_divisors(10, 260))
print(sum_common_divisors(10, 270))
print(sum_common_divisors(10, 280))
print(sum_common_divisors(10, 290))
print(
codegen-6b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
"""
>>> sum_of_common_divisors(10,15)
6
>>> sum_of_common_divisors(10,20)
10
>>> sum_of_common_divisors(10,25)
5
>>> sum_of_common_divisors(10,30)
10
>>> sum_of_common_divisors(10,35)
5
>>> sum_of_common_divisors(10,40)
10
>>> sum_of_common_divisors(10,45)
5
>>> sum_of_common_divisors(10,50)
10
>>> sum_of_common_divisors(10,55)
5
>>> sum_of_common_divisors(10,60)
10
>>> sum_of_common_divisors(10,65)
5
>>> sum_of_common_divisors(10,70)
10
>>> sum_of_common_divisors(10,75)
5
>>> sum_of_common_divisors(10,80)
10
>>> sum_of_common_divisors(10,85)
5
>>> sum_of_common_divisors(10,90)
10
>>> sum_of_common_divisors(10,95)
5
>>> sum_of_common_divisors(10,100)
10
>>> sum_of_common_divisors(10,105)
5
>>> sum_of_common_divisors(10,110)
10
>>> sum_of_common_divisors(10,115)
5
>>> sum_of_common_divisors(10,120)
10
>>> sum_of_common_divisors(10,125)
5
>>> sum_of_common_divisors(10,130)
10
>>> sum_of_common_divis
gpt-4-1106-preview. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
import math
def sum_of_common_divisors(a, b):
def common_divisors(n1, n2):
divisors = []
for i in range(1, min(n1, n2) + 1):
if n1 % i == 0 and n2 % i == 0:
divisors.append(i)
return divisors
return sum(common_divisors(a, b))
# Example usage:
# assert sum_of_common_divisors(10, 15) == 6
gemma-7b-it. fail_base: True, fail_plus: True
import math
def sum(num1, num2):
common_divisors = []
for i in range(1, int(math.sqrt(num1)) + 1):
if i * i <= num1 and i * i <= num2:
if num1 % i == 0 and num2 % i == 0:
common_divisors.append(i)
return sum(common_divisors)
opencodeinterpreter-ds-33b. fail_base: True, fail_plus: True
```python
def sum_common_divisors(num1, num2):
def find_divisors(num):
divisors = [1]
for i in range(2, int(num**0.5) + 1):
if num % i == 0:
divisors.append(i)
if i != num // i:
divisors.append(num // i)
return divisors
divisors1 = find_divisors(num1)
divisors2 = find_divisors(num2)
common_divisors = set(divisors1) & set(divisors2)
return sum(common_divisors)
# Test the function
print(sum_common_divisors(10, 15)) # Output: 6
openchat. fail_base: True, fail_plus: True
def sum_of_common_divisors(num1, num2):
common_divisors = []
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
common_divisors.append(i)
return sum(common_divisors)
assert sum_of_common_divisors(10, 15) == 6
speechless-starcoder2-7b. fail_base: True, fail_plus: True
def sum_of_common_divisors(num1, num2):
# Find the common divisors
common_divisors = [i for i in range(1, min(num1, num2) + 1) if num1 % i == 0 and num2 % i == 0]
# Return the sum of common divisors
return sum(common_divisors)
# Test the function
assert sum_of_common_divisors(10, 15) == 6
wizardcoder-7b. fail_base: True, fail_plus: True
Here's a Python function that finds the sum of common divisors of two given numbers:
```python
def sum_of_common_divisors(num1, num2):
"""
This function takes two numbers as input and returns the sum of their common divisors.
"""
divisors = []
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
divisors.append(i)
return sum(divisors)
```
To test the function, you can call it with the given input:
```python
print(sum_of_common_divisors(10, 15)) # Output: 6
```
Explanation:
The function first initializes an empty list called `divisors`. It then loops through all the numbers from 1 to the smaller of the two input numbers (inclusive) and checks if each number is a divisor of both `num1` and `num2`. If it is, it adds it to the `divisors` list. Finally, it returns the sum of the `divisors` list. In this case, the common divisors of 10 and 15 are 1, 5, and 10, so the output is 6.
octocoder. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_common_divisors(num1, num2):
"""
Find the sum of common divisors of two given numbers.
"""
divisors = []
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
divisors.append(i)
return sum(divisors)
gemma-1.1-7b-it. fail_base: True, fail_plus: True
def sumCommonDivisors(a, b):
commonDivisors = set()
for i in range(1, min(a, b) + 1):
if i % a == 0 and i % b == 0:
commonDivisors.add(i)
return sum(commonDivisors)
assert sumCommonDivisors(10,15) == 6
deepseek-coder-6.7b-base. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_common_divisors(a, b):
"""
Find the sum of common divisors of two given numbers.
"""
return sum(i for i in range(1, min(a, b) + 1) if a % i == 0 and b % i == 0)
if __name__ == "__main__":
assert sum_common_divisors(10, 15) == 6
assert sum_common_divisors(10, 10) == 10
assert sum_common_divisors(10, 1) == 1
assert sum_common_divisors(10, 2) == 1
assert sum_common_divisors(10, 3) == 1
assert sum_common_divisors(10, 4) == 3
assert sum_common_divisors(10, 5) == 2
assert sum_common_divisors(10, 6) == 4
assert sum_common_divisors(10, 7) == 1
assert sum_common_divisors(10, 8) == 5
assert sum_common_divisors(10, 9) == 3
assert sum_common_divisors(10, 10) == 10
assert sum_common_divisors(10, 11) == 1
assert sum_common_divisors(10, 12) == 6
assert sum_common_divisors(10, 13) == 1
assert sum_common_divisors(10, 14) == 2
assert sum_common_divisors(10, 15) == 6
assert sum_common_divisors(10, 16) == 7
assert sum_common_divisors(10, 17) == 1
assert sum_common_divisors(10, 18) == 9
assert sum_common_divisors(10, 19) == 1
assert sum_common_divisors(10,
codegen-16b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
"""
>>> sum_of_common_divisors(10,15)
6
>>> sum_of_common_divisors(10,20)
10
>>> sum_of_common_divisors(10,25)
5
>>> sum_of_common_divisors(10,30)
10
>>> sum_of_common_divisors(10,35)
5
>>> sum_of_common_divisors(10,40)
10
>>> sum_of_common_divisors(10,45)
5
>>> sum_of_common_divisors(10,50)
10
>>> sum_of_common_divisors(10,55)
5
>>> sum_of_common_divisors(10,60)
10
>>> sum_of_common_divisors(10,65)
5
>>> sum_of_common_divisors(10,70)
10
>>> sum_of_common_divisors(10,75)
5
>>> sum_of_common_divisors(10,80)
10
>>> sum_of_common_divisors(10,85)
5
>>> sum_of_common_divisors(10,90)
10
>>> sum_of_common_divisors(10,95)
5
>>> sum_of_common_divisors(10,100)
10
>>> sum_of_common_divisors(10,105)
5
>>> sum_of_common_divisors(10,110)
10
>>> sum_of_common_divisors(10,115)
5
>>> sum_of_common_divisors(10,120)
10
>>> sum_of_common_divisors(10,125)
5
>>> sum_of_common_divisors(10,130)
10
>>> sum_of_common_divis
mistral-7b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(a, b):
"""
:param a: int
:param b: int
:return: int
"""
if a < 0 or b < 0:
raise ValueError("a and b must be positive")
if a == 0 or b == 0:
return 0
if a == b:
return a
if a > b:
a, b = b, a
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
sum_of_common_divisors += i
return sum_of_common_divisors
if __name__ == '__main__':
assert sum_of_common_divisors(10, 15) == 6
assert sum_of_common_divisors(10, 10) == 10
assert sum_of_common_divisors(10, 0) == 0
assert sum_of_common_divisors(0, 10) == 0
assert sum_of_common_divisors(0, 0) == 0
assert sum_of_common_divisors(10, 1) == 1
assert sum_of_common_divisors(1, 10) == 1
assert sum_of_common_divisors(1, 1) == 1
assert sum_of_common_divisors(1, 0) == 0
assert sum_of_common_divisors(0, 1) == 0
assert sum_of_common_divisors(1, -1) == 1
assert sum_of_common_divisors(-1, 1) == 1
assert sum_of_common_divisors(-1, -1) == 1
assert sum_of_common_divisors(-1, 0) == 0
assert sum_of_common_divisors(0, -1) == 0
assert sum_of
speechless-mistral-7b. fail_base: True, fail_plus: True
def sum_of_common_divisors(num1, num2):
common_divisors = []
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
common_divisors.append(i)
return sum(common_divisors)
assert sum_of_common_divisors(10, 15) == 6
```
This Python function `sum_of_common_divisors` takes two numbers as input and returns the sum of their common divisors. It first finds all the divisors of the two numbers using a for loop, then checks if each divisor is common to both numbers, and finally adds it to the list of common divisors if it is. Finally, it returns the sum of the common divisors using the built-in `sum` function. The assert statement at the end checks if the function works correctly for the given example.
codet5p-16b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
sum = 0
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
sum += i
return sum
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
print(sum_of_common_divisors(10,15))
print(sum_of_common_divisors(15,10))
code-llama-13b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1, num2):
common_divisors = []
for i in range(1, num1+1):
if num1 % i == 0 and num2 % i == 0:
common_divisors.append(i)
return sum(common_divisors)
print(sum_of_common_divisors(10, 15))
print(sum_of_common_divisors(10, 12))
print(sum_of_common_divisors(10, 11))
print(sum_of_common_divisors(10, 10))
print(sum_of_common_divisors(10, 9))
print(sum_of_common_divisors(10, 8))
print(sum_of_common_divisors(10, 7))
print(sum_of_common_divisors(10, 6))
print(sum_of_common_divisors(10, 5))
print(sum_of_common_divisors(10, 4))
print(sum_of_common_divisors(10, 3))
print(sum_of_common_divisors(10, 2))
print(sum_of_common_divisors(10, 1))
xdan-l1-chat. fail_base: True, fail_plus: True
def sum_common_divisors(num1, num2):
# Convert the numbers to positive integers
num1 = abs(int(num1))
num2 = abs(int(num2))
# Calculate the greatest common divisor (GCD) using Euclidean algorithm
while num2:
num1, num2 = num2, num1 % num2
# The sum of common divisors is the product of the numbers divided by the GCD
return (num1 * num2) // num1
# Test the function
assert sum_common_divisors(10, 15) == 6
solar-10.7b-instruct. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(num1: int, num2: int) -> int:
divisors_set = set()
for i in range(1, max(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
divisors_set.add(i)
return sum(divisors_set)
assert sum_of_common_divisors(10, 15) == 6
gemma-2b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(a, b):
return sum(i for i in range(1, min(a, b) + 1) if a % i == 0 and b % i == 0)
claude-3-sonnet-20240229. fail_base: True, fail_plus: True
Here's the Python function to find the sum of common divisors of two given numbers, wrapped in a markdown block:
```python
def sum_common_divisors(a, b):
"""
Find the sum of common divisors of two given numbers.
Args:
a (int): The first number.
b (int): The second number.
Returns:
int: The sum of common divisors of a and b.
"""
divisors_a = set()
divisors_b = set()
# Find divisors of a
for i in range(1, a + 1):
if a % i == 0:
divisors_a.add(i)
# Find divisors of b
for i in range(1, b + 1):
if b % i == 0:
divisors_b.add(i)
# Find common divisors
common_divisors = divisors_a.intersection(divisors_b)
# Calculate the sum of common divisors
sum_of_common_divisors = sum(common_divisors)
return sum_of_common_divisors
# Test case
assert sum_common_divisors(10, 15) == 6
starcoder2-15b-oci. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_common_divisors(num1, num2):
divisors = set()
for i in range(1, min(num1, num2) + 1):
if num1 % i == 0 and num2 % i == 0:
divisors.add(i)
return sum(divisors)
starcoder2-3b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_common_divisors(a,b):
"""
:param a: first number
:param b: second number
:return: sum of common divisors
"""
if a == 0 or b == 0:
return 0
elif a == 1 or b == 1:
return 1
else:
return sum_of_common_divisors(a-1,b) + sum_of_common_divisors(a,b-1) - sum_of_common_divisors(a-1,b-1)
print(sum_of_common_divisors(10,15))
/python/leetcode/1001-1100/1001.py
"""
Given an array of integers A and let n to be its length.
Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a "rotation function" F on A as follow:
F(k) = 0 * Bk[0] + 1 * Bk[1] + ... + (n-1) * Bk[n-1].
Calculate the maximum value of F(0), F(1), ..., F(n-1).
Note:
n is guaranteed to be less than 105.
Example:
A = [4, 3, 2, 6]
F(0) = (0 * 4) + (1 * 3) + (2 * 2) + (3 * 6) = 0 + 3 + 4 + 18 = 25
F(1) = (0 * 6) + (1 * 4) + (2 * 3) + (3 * 2) = 0 + 4 + 6 + 6 = 16
F(2) = (0 * 2) + (1 * 6) + (2 * 4) + (3 * 3) = 0 + 6 + 8 + 9 = 23
F(3) = (0 * 3) + (1 * 2) + (2 * 6) + (3 * 4) =
speechless-starcoder2-15b. fail_base: True, fail_plus: True
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def sum_common_divisors(a, b):
gcd_ab = gcd(a, b)
sum_divisors = 0
for i in range(1, gcd_ab + 1):
if gcd_ab % i == 0:
sum_divisors += i
return sum_divisors
assert sum_common_divisors(10, 15) == 6
gemma-7b. fail_base: True, fail_plus: True
"""
Write a python function to find the sum of common divisors of two given numbers.
assert sum(10,15) == 6
"""
def sum_of_divs(a, b):
divs = []
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
divs.append(i)
return sum(divs)
opencodeinterpreter-ds-6.7b. fail_base: True, fail_plus: True
```python
def sum_common_divisors(num1, num2):
def get_divisors(num):
divisors = []
for i in range(1, num + 1):
if num % i == 0:
divisors.append(i)
return divisors
divisors1 = get_divisors(num1)
divisors2 = get_divisors(num2)
common_divisors = [divisor for divisor in divisors1 if divisor in divisors2]
return sum(common_divisors)
# Test the function
print(sum_common_divisors(10, 15))