import numpy as np
ls = np.array((256, 304, 397, 465, 477, 497))
val = 4600
def main():
k = np.zeros_like(ls)
def check(i=0):
v = sum(ls * k)
if v == val:
raise ValueError(k)
elif v > val:
k[i] = 0
k[i + 1] += 1
check(i + 1)
while True:
k[0] += 1
print(k)
check()
main()
<script type="text/javascript">
$(document).ready(function(){
var a = Number(prompt('Введите число'));
$("#number").html(a);
$("button").on('click',function(){
var b = String("456");
b.split("");
a = '<span class="new">';
for (var e = 0; e < b.length; e++) a += "<span>" + b.charAt(e) + "</span>";
a += "</span>";
d.find(".new").attr("class", "cur");
d.append(a);
d.find(".cur").fadeOut(100, function() {
c(this).remove()
});
e = 1;
d.find(".new span").each(function() {
c(this).delay(parseInt(150 / b.length) * e++).animate({
top: 0
}, "fast")
})
});
});
</script>