<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
var a = new Array;
var i;
function cha() {
str = "M = ";
for (i = 0; i <= 6; i++) {
a[i] = Math.round(-50 + Math.random() * 100);
str += a[i] + " "
}
document.getElementById("mas").innerHTML = str + "</br>"
}
function ch1() {
var y, q, c, d, b;
var str = "F(y) = ";
for (y = 1; y <= 4; y++) {
b = 0;
for (q = 6; q >= 0; q--) {
c = Math.pow(y + 1, q);
d = Math.pow(y, q);
b += a[q] * (c - d)
}
str += b + " "
}
document.getElementById("output").innerHTML = str + "</br>"
};
</script>
</head>
<body style="padding:20px;" onload="cha();">
<p id="mas"></p>
<p id="output"></p>
<p><input type="button" value="Решение" onclick="ch1();" /></p>
</body>
</html>