<script> function a(n,x) { var sum = x; for (var i = 0; i < n; ){ x = x * 1.3 + 300 * ++i; sum += x } return [n,x,sum] } ; for (var i=0; i<10; i++) {document.write(a(i,100).join(" ")+ "<br>")} </script>