Adjusted sum X23872


Statement
 

pdf   zip

html

Dessign the function suma_ajustada(limit, k, maxim) that, given three integers greater tha zero limit, k and maxim, returns the longest increasing list formed by consecutive multiples of k lower than maxim that add up less than limit. If the list is not emptemty its first element has to be k.

Sample session
>>> suma_ajustada(20, 3, 1000)
[3, 6, 9]
>>> suma_ajustada(10, 1, 1000)
[1, 2, 3]
>>> suma_ajustada(10, 1, 3)
[1, 2]
>>> suma_ajustada(100, 2, 10)
[2, 4, 6, 8]
>>> suma_ajustada(5, 4, 4)
[]
>>> suma_ajustada(5, 5, 50)
[]
Information
Author
InfBesos
Language
English
Other languages
Catalan Spanish
Official solutions
Python
User solutions
Python