Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
28
Task/M-bius-function/ANSI-BASIC/m-bius-function.basic
Normal file
28
Task/M-bius-function/ANSI-BASIC/m-bius-function.basic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
100 REM Moebius function
|
||||
110 DECLARE EXTERNAL FUNCTION Moebius
|
||||
120 FOR T = 0 TO 9
|
||||
130 FOR U = 1 TO 10
|
||||
140 PRINT USING "## ": Moebius(10 * T + U);
|
||||
150 NEXT U
|
||||
160 PRINT
|
||||
170 NEXT T
|
||||
180 END
|
||||
190 REM ***
|
||||
200 EXTERNAL FUNCTION Moebius(N)
|
||||
210 LET M = 1
|
||||
220 IF N <> 1 THEN
|
||||
230 LET F = 2
|
||||
240 DO
|
||||
250 IF MOD(N, (F * F)) = 0 THEN
|
||||
260 LET M = 0
|
||||
270 ELSE
|
||||
280 IF MOD(N, F) = 0 THEN
|
||||
290 LET M = -M
|
||||
300 LET N = N / F
|
||||
310 END IF
|
||||
320 LET F = F + 1
|
||||
330 END IF
|
||||
340 LOOP WHILE (F <= N) AND (M <> 0)
|
||||
350 END IF
|
||||
360 LET Moebius = M
|
||||
370 END FUNCTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue