Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
28
Task/M-bius-function/QuickBASIC/m-bius-function.basic
Normal file
28
Task/M-bius-function/QuickBASIC/m-bius-function.basic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
' Moebius function
|
||||
DECLARE FUNCTION Moebius% (N%)
|
||||
FOR T% = 0 TO 9
|
||||
FOR U% = 1 TO 10
|
||||
PRINT USING "## "; Moebius%(10 * T% + U%);
|
||||
NEXT U%
|
||||
PRINT
|
||||
NEXT T%
|
||||
END
|
||||
|
||||
FUNCTION Moebius% (N%)
|
||||
M% = 1
|
||||
IF N% <> 1 THEN
|
||||
F% = 2
|
||||
DO
|
||||
IF (N% MOD (F% * F%)) = 0 THEN
|
||||
M% = 0
|
||||
ELSE
|
||||
IF N% MOD F% = 0 THEN
|
||||
M% = -M%
|
||||
N% = N% \ F%
|
||||
END IF
|
||||
F% = F% + 1
|
||||
END IF
|
||||
LOOP WHILE (F% <= N%) AND (M% <> 0)
|
||||
END IF
|
||||
Moebius% = M%
|
||||
END FUNCTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue