# Default case (m, a = 31, 13); small full period
lehmer(plotDelay = 0, numSteps = 16)
lehmer(numSteps = 10, plotDelay = 0.1) # auto-advance mode
if (interactive()) {
lehmer(plotDelay = -1) # plotDelay -1 uses interactive mode
}
# multiplier producing period of length 5, with different seeds
lehmer(a = 8, m = 31, seed = 1, numSteps = 5, plotDelay = 0.1)
lehmer(a = 8, m = 31, seed = 24, numSteps = 5, plotDelay = 0.1)
# degenerate cases where seed does not appear in the final period
lehmer(a = 12, m = 20, seed = 7, numSteps = 4, plotDelay = 0.1) # length 4
lehmer(a = 4, m = 6, seed = 1, numSteps = 1, plotDelay = 0.1) # length 1
Run the code above in your browser using DataLab