R/aaa.R

Defines functions `modulus`

`modulus` <- function(n){ # Here 'n' is the modulus.
                                        # Workflow modelled on sol() in the lorentz() package
    if(missing(n)){ # An empty argument returns the working modulus, just like in the lorentz package sol() returns speed of light
        return(getOption("M"))
    } else {  # working modulus, n, supplied
        
        stopifnot(is.numeric(n))
        stopifnot(length(n)==1)
        stopifnot(n==round(n))
        stopifnot(n>1)
        
        options("M" = n)
        options("phi" = numbers::eulersPhi(n))
        options("prompt" = paste("Modulo(", n, ") > ",sep=""))
    }
}
RobinHankin/clock documentation built on Nov. 8, 2021, 6:17 p.m.