Adjusted sum X23872


Statement
 

pdf   zip

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

Sample session

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