Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
34
Task/M-bius-function/Amazing-Hopper/m-bius-function.hopper
Normal file
34
Task/M-bius-function/Amazing-Hopper/m-bius-function.hopper
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include <basico.h>
|
||||
|
||||
#proto cálculodeMobius(_X_)
|
||||
#synon _cálculodeMobius calcularMobius
|
||||
|
||||
algoritmo
|
||||
|
||||
imprimir ("Mobius numbers from 1..199\n")
|
||||
i=0, s=1
|
||||
iterar grupo( ++i, #(i<=199), calcular Mobius (i), \
|
||||
solo si (#( iszero(s%20) ), NL;s=0 ), imprimir, ++s )
|
||||
saltar
|
||||
terminar
|
||||
|
||||
subrutinas
|
||||
|
||||
cálculo de Mobius (n)
|
||||
si( #(n==0) ) ; tomar '" "'
|
||||
sino si( #(n==1) ); tomar '" 1"'
|
||||
sino; p=0
|
||||
iterar para (i=1, #(i<=n+1), ++i)
|
||||
si ( #( iszero(n%i) && isprime(i)) )
|
||||
cuando ( #( iszero(n%(i*i)) ) ){
|
||||
tomar '" 0"'; ir a (herejía) /* ¡! */
|
||||
} ++p
|
||||
fin si
|
||||
siguiente
|
||||
tomar si ( es impar(p), " -1", " 1" )
|
||||
fin si
|
||||
|
||||
/* ¡Dios! ¡Purifica esta mierda! ----+ */
|
||||
/* | */
|
||||
herejía: /* <----------------------+ */
|
||||
retornar
|
||||
Loading…
Add table
Add a link
Reference in a new issue