Odd sum X48913


Statement
 

pdf   zip

Write a function @odd_sum(a, b)@ that gets two integers aa and bb greater than zero and returns the sum of the odd integers nn that are not multiple of bb and 0<na0 < n\le a. For instance @odd_sum(11, 3)@ is 1+5+7+11=241 + 5 + 7 + 11 = 24.

Sample session

Sample session
>>> odd_sum(11, 3)
24
>>> odd_sum(15, 1)
0
>>> odd_sum(9, 11)
25
>>> odd_sum(12, 3)
24
>>> odd_sum(7, 7)
9
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python