Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
37
Task/M-bius-function/ASIC/m-bius-function.asic
Normal file
37
Task/M-bius-function/ASIC/m-bius-function.asic
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
REM Moebius function
|
||||
FOR T = 0 TO 9
|
||||
FOR U = 1 TO 10
|
||||
N = 10 * T
|
||||
N = N + U
|
||||
GOSUB CalcMoebius:
|
||||
PRINT M;
|
||||
NEXT U
|
||||
PRINT
|
||||
NEXT T
|
||||
END
|
||||
|
||||
CalcMoebius:
|
||||
REM Calculate Moebius(N). Result in M.
|
||||
REM NOTE. N changes its value.
|
||||
M = 1
|
||||
IF N <> 1 THEN
|
||||
F = 2
|
||||
StartLoop:
|
||||
FTo2 = F * F
|
||||
NModFTo2 = N MOD FTo2
|
||||
IF NModFTo2 = 0 THEN
|
||||
M = 0
|
||||
ELSE
|
||||
NModF = N MOD F
|
||||
IF NModF = 0 THEN
|
||||
M = -M
|
||||
N = N / F
|
||||
ENDIF
|
||||
F = F + 1
|
||||
ENDIF
|
||||
IF M = 0 THEN AfterLoop:
|
||||
IF F > N THEN AfterLoop:
|
||||
GOTO StartLoop:
|
||||
AfterLoop:
|
||||
ENDIF
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue