chainikd,
ой
<script>
function diff(max, min) {
max = max.split("").reverse();
min = min.split("").reverse();
var len = Math.max(max.length, min.length),
result = [];
for (var i = 0, b = 0, c = 0; i <= len; i++) {
b = (+max[i] || 0) + (+min[i] || 0) + c;
result[i] = b > 9 ? (c = 1, b - 10) : (c = 0, b)
}
return result.reverse().join("").replace(/^0+/, "")
}
function sum(x, y) {
var res = "0";
for (var i = 0; i < y; i++) res = diff(res, "" + x);
return res
}
var re = /(?=\B(?:\d{3})+(?!\d+))/g;
var result = "1";
var r = 200;
for (var i = 1; i <= r; i++) {
result = sum(result, "" + i);
document.write(i + " => " + result.replace(re, " ") + "<br><hr>")
};
</script>