Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
32
Task/M-bius-function/JavaScript/m-bius-function-1.js
Normal file
32
Task/M-bius-function/JavaScript/m-bius-function-1.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Moebius function
|
||||
|
||||
function moebius(n) {
|
||||
m = 1;
|
||||
if (n != 1) {
|
||||
f = 2;
|
||||
do {
|
||||
if (n % (f * f) == 0) {
|
||||
m = 0;
|
||||
} else {
|
||||
if (n % f == 0) {
|
||||
m = -m;
|
||||
n /= f;
|
||||
}
|
||||
f++;
|
||||
}
|
||||
} while (f <= n && m != 0);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
document.write("<table style=\"text-align:right\">");
|
||||
for (t = 0; t <= 9; t++) {
|
||||
document.write("<tr>");
|
||||
for (u = 1; u <= 10; u++) {
|
||||
document.write("<td>");
|
||||
document.write(moebius(10 * t + u));
|
||||
document.write("</td>");
|
||||
}
|
||||
document.write("</tr>");
|
||||
}
|
||||
document.write("</table>");
|
||||
Loading…
Add table
Add a link
Reference in a new issue