cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A385337 Consecutive states of the linear congruential pseudo-random number generator (1291*s + 4621) mod 21870 when started at s=1.

Original entry on oeis.org

1, 5912, 4383, 20614, 1505, 1146, 18817, 21668, 6279, 18910, 10511, 14922, 1453, 21494, 345, 12616, 20597, 1428, 11089, 17540, 13311, 21172, 173, 9264, 1555, 86, 6297, 20278, 5129, 21420, 14161, 3152, 6033, 7504, 3875, 20886, 2737, 17018, 17379, 2290, 8561
Offset: 1

Views

Author

Sean A. Irvine, Jun 25 2025

Keywords

Comments

Periodic with period 21870.
Described in Numerical Recipes as a "quick and dirty" generator.

References

  • William H. Press, Saul A. Teukolsky, William T. Vetterling, and Brian P. Flannery, Numerical Recipes in C (2nd ed), Cambridge University Press, 1999 (see p. 285).

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          irem(1291*a(n-1)+4621, 21870))
        end:
    seq(a(n), n=1..44);  # after Alois P. Heinz
  • Mathematica
    NestList[Mod[1291*# + 4621, 21870] &, 1, 50] (* after Paolo Xausa *)

Formula

a(n) = (1291 * a(n-1) + 4621) mod 21870.