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.

Previous Showing 21-30 of 70 results. Next

A096557 Consecutive internal states of the linear congruential pseudo-random number generator rand() used in Microsoft's Visual C++.

Original entry on oeis.org

0, 2531011, 505908858, 3539360597, 159719620, 2727824503, 773150046, 548247209, 2115878600, 2832368235, 2006221698, 2531105853, 3989110284, 2222380191, 2165923046, 1345953809, 1043415696, 586225427, 3870123402, 2343900709, 3109564500, 3522190791, 2090033518, 3566711417
Offset: 1

Views

Author

Hugo Pfoertner, Jul 21 2004

Keywords

Crossrefs

Cf. A096558 corresponding output. A096550-A096561 other pseudo-random number generators.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, 0,
          irem(214013 *a(n-1) +2531011, 4294967296))
        end:
    seq(a(n), n=1..30);  # Alois P. Heinz, Jun 10 2014
  • Mathematica
    NestList[Mod[#*214013 + 2531011, 2^32] &, 0, 50] (* Paolo Xausa, Aug 29 2024 *)
  • PARI
    A096557(n)=lift((Mod(214013,2^34)^(n-1)-1)*13129821757)>>2 \\ M. F. Hasler, May 14 2015

Formula

a(1)=0, a(n)=(a(n-1) * 214013 + 2531011) mod 2^32. The sequence is periodic with period length 2^32.

A381318 Consecutive internal states of the linear congruential pseudo-random number generator (5^11*s+36643009) mod 2^30 when started at s=1.

Original entry on oeis.org

1, 85471134, 226025511, 290047084, 367499773, 919594538, 41492227, 69996632, 355863737, 216742518, 668535967, 32946180, 903885877, 903092354, 636577019, 361498480, 694791281, 514862158, 296723479, 683149980, 429969773, 598532570, 103941619, 668765576
Offset: 1

Views

Author

Sean A. Irvine, May 26 2025

Keywords

Comments

Periodic with period 2^30.
The numbers on p. 124 of Grame and O'Donnel are given by s/2^30 using this generator starting from s=714133185.

References

  • Carl Grame and Dan O'Donnel, Learning BASIC: Programming Essentials, Science Research Associates, 1984 (see p. 124).

Crossrefs

Cf. A096550-A096561 other pseudo-random number generators.
Cf. A384388 (similar parameters).

Programs

  • Mathematica
    NestList[Mod[5^11*# + 36643009, 2^30] &, 1, 50] (* Paolo Xausa, May 27 2025 *)

Formula

a(n) = (5^11 * a(n-1) + 36643009) mod 2^30.

A383940 Consecutive states of the linear congruential pseudo-random number generator (25173*s+13849) mod 2^16 when started at s=1.

Original entry on oeis.org

1, 39022, 61087, 20196, 45005, 3882, 21259, 65216, 19417, 30502, 20919, 26076, 16421, 44130, 63139, 32824, 14513, 51934, 36303, 35284, 8573, 11930, 41787, 65200, 9865, 29590, 743, 39628, 46037, 30162, 47315, 23080, 30049, 20814, 4351, 30916, 22317, 25098
Offset: 1

Views

Author

Sean A. Irvine, May 21 2025

Keywords

Comments

Periodic with period 2^16.
This was a popular generator in the 1980's due to Grogono's book, but the period was too short for serious scientific use.

References

  • Peter Grogono, Programming in Pascal (2nd ed.), Addison-Wesley, 1984 (see pp. 136-137).

Crossrefs

Cf. A096550-A096561 (other pseudo-random number generators).
Cf. A384082, A384085, A384150, A384194 (other early generators for Pascal).
Cf. A384220 (similar generator for Smalltalk-80).

Programs

  • Mathematica
    NestList[Mod[25173*# + 13849, 2^16] &, 1, 100] (* Paolo Xausa, May 22 2025 *)

Formula

a(n) = (25173 * a(n-1) + 13849) mod 2^16.

A384114 Consecutive states of the linear congruential pseudo-random number generator (125*s+1) mod 2^12 when started at s=1.

Original entry on oeis.org

1, 126, 3463, 2796, 1341, 3786, 2211, 1944, 1337, 3286, 1151, 516, 3061, 1698, 3355, 1584, 1393, 2094, 3703, 28, 3501, 3450, 1171, 3016, 169, 646, 2927, 1332, 2661, 850, 3851, 2144, 1761, 3038, 2919, 332, 541, 2090, 3203, 3064, 2073, 1078, 3679, 1124, 1237
Offset: 1

Views

Author

Sean A. Irvine, May 19 2025

Keywords

Comments

Periodic with period 4096.

References

  • W. F. Clocksin and C. S. Mellish, Programming in Prolog, Springer-Verlag, 1981 (see p. 149).

Crossrefs

Cf. A096550-A096561 other pseudo-random number generators.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          irem(125*a(n-1)+1, 2^12))
        end:
    seq(a(n), n=1..45);  # Alois P. Heinz, May 19 2025
  • Mathematica
    a[1] = 1; a[n_] := a[n] = Mod[125*a[n - 1] + 1, 2^12]; Array[a, 45, 1] (* Shenghui Yang, May 19 2025 *)

Formula

a(n) = (125*a(n-1) + 1) mod 2^12.

A384150 Consecutive states of the linear congruential pseudo-random number generator (10924*s+11830) mod (2^15+1) when started at s=1.

Original entry on oeis.org

1, 22754, 23661, 2722, 25475, 26382, 5443, 28196, 29103, 8164, 30917, 31824, 10885, 869, 1776, 13606, 3590, 4497, 16327, 6311, 7218, 19048, 9032, 9939, 21769, 11753, 12660, 24490, 14474, 15381, 27211, 17195, 18102, 29932, 19916, 20823, 32653, 22637, 23544
Offset: 1

Views

Author

Sean A. Irvine, May 21 2025

Keywords

Comments

Periodic with period 32769.
This generator was given in Pascal by Richard Lamb in 1986. It was a reasonable generator for its time (with full period), but the period is way too small for modern use.

References

  • Richard Lamb, Pascal: Structure and Style, Benjamin-Cummings, 1986 (see pp. 226-227).

Crossrefs

Cf. A096550-A096561 other pseudo-random number generators.

Programs

  • Mathematica
    NestList[Mod[10924*# + 11830, 2^15 + 1] &, 1, 100] (* Paolo Xausa, May 22 2025 *)
  • PARI
    my(f=Mod(10924, 10923*32769)); \
    a(n) = lift(22753*f^((n-1) % 32769) - 11830) /10923; \\ Kevin Ryde, May 22 2025

Formula

a(n) = (10924 * a(n-1) + 11830) mod (2^15+1).

A384196 Consecutive states of the linear congruential pseudo-random number generator 20403*s mod 2^15 when started at s=1.

Original entry on oeis.org

1, 20403, 30505, 30891, 9361, 20579, 16953, 25819, 6689, 29715, 1609, 27659, 28849, 27331, 21337, 15931, 14401, 25715, 14697, 2923, 209, 4387, 18553, 923, 23137, 8403, 4233, 22219, 21745, 17283, 8601, 13563, 129, 10547, 2985, 20011, 27921, 483, 24249, 21083
Offset: 1

Views

Author

Sean A. Irvine, May 21 2025

Keywords

Comments

Periodic with period 8192 (considerably smaller than the modulus).

References

  • Fred Maryanski, Digital Computer Simulation, Hayden Book Co., 1980 (see p. 224-230).

Crossrefs

Cf. A096550-A096561 (other pseudo-random number generators).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          irem(20403*a(n-1), 2^15))
        end:
    seq(a(n), n=1..40);  # Alois P. Heinz, May 21 2025
  • Mathematica
    NestList[Mod[20403*#, 2^15] &, 1, 100] (* Paolo Xausa, May 22 2025 *)
  • PARI
    a(n) = lift(Mod(20403,32768)^(n-1)) \\ Jianing Song, Jul 06 2025

Formula

a(n) = 20403 * a(n-1) mod 2^15.

A384221 Consecutive states of the linear congruential pseudo-random number generator for the Texas Instruments TI99 when started at 1.

Original entry on oeis.org

1, 60062, 56335, 54564, 49133, 60602, 58139, 22240, 20761, 56598, 51559, 19676, 40837, 55218, 39667, 29464, 55089, 14478, 41919, 50580, 25629, 39850, 28619, 32848, 62025, 56582, 51991, 8012, 28085, 6306, 49571, 24200, 609, 43646, 40815, 14852, 7245, 11930
Offset: 1

Views

Author

Sean A. Irvine, May 22 2025

Keywords

Comments

Periodic with period 2^16.

Crossrefs

Cf. A096550-A096561 other pseudo-random number generators.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          irem(28645*a(n-1)+31417, 2^16))
        end:
    seq(a(n), n=1..38);  # Alois P. Heinz, May 22 2025
  • Mathematica
    NestList[Mod[28645*# + 31417, 2^16] &, 1, 50] (* Paolo Xausa, May 23 2025 *)

Formula

a(n) = (28645 * a(n-1) + 31417) mod 2^16.

A096553 Consecutive states of the linear congruential pseudo-random number generator used in function rand() in the Standard C library (VAX C) when started at 1.

Original entry on oeis.org

1, 1103527590, 377401575, 662824084, 1147902781, 2035015474, 368800899, 1508029952, 486256185, 1062517886, 267834847, 180171308, 836760821, 595337866, 790425851, 2111915288, 1149758321, 1644289366, 1388290519, 1647418052, 1675546029
Offset: 1

Views

Author

Hugo Pfoertner, Jul 18 2004

Keywords

Comments

This is also the sequence of internal states of the generator described in Kernighan and Ritchie, which produces output limited to 15bit, see A061364. - A-number corrected by Jean-Claude Arbaut, Oct 05 2015

References

  • Brian W Kernighan and Dennis M. Ritchie, The C Programming Language (Second Edition) Prentice Hall Software Series, 1988.

Crossrefs

Cf. A096550-A096561 (other pseudo-random number generators).

Programs

  • Magma
    [n eq 1 select 1 else (1103515245 * Self(n-1) + 12345) mod (2^31): n in [1..25]]; // Vincenzo Librandi, Oct 06 2015
  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          irem(1103515245 *a(n-1)+12345, 2147483648))
        end:
    seq(a(n), n=1..30);  # Alois P. Heinz, Jun 10 2014
  • Mathematica
    With[{c=2^31},NestList[Mod[1103515245#+12345,c]&,1,20]] (* Harvey P. Dale, Aug 01 2012 *)
  • PARI
    a(n) = if(n<2, 1, (1103515245 * a(n-1) + 12345) % (2^31));
    vector(100, n, a(n)) \\ Altug Alkan, Oct 05 2015
    

Formula

a(1)=1, a(n) = (1103515245 * a(n-1) + 12345) mod 2^31.

A096555 Consecutive internal states of the linear congruential pseudo-random number generator RANDU that was used in the IBM Scientific Subroutine Library for IBM System/360 computers in the 1970's.

Original entry on oeis.org

1, 65539, 393225, 1769499, 7077969, 26542323, 95552217, 334432395, 1146624417, 1722371299, 14608041, 1766175739, 1875647473, 1800754131, 366148473, 1022489195, 692115265, 1392739779, 2127401289, 229749723, 1559239569, 845238963, 1775695897, 899541067, 153401569
Offset: 1

Views

Author

Hugo Pfoertner, Jul 19 2004

Keywords

Comments

Due to a poor choice of the multiplier the generator fails most 3-d criteria for randomness. 9*a(n-2)-6*a(n-1)+a(n) = 0 mod 2^31. This was first described by George Marsaglia. The animated gif in the link demonstrates the deficient behavior. The animation shows 10000 points, each of whose coordinate triples (x,y,z) were formed from successive outputs of the generator. From a suitable view angle, it can be seen that these points do not fill the 3-D space, but lie in a few planes parallel to each other.

References

  • D. E. Knuth, The Art of Computer Programming Third Edition. Vol. 2 Seminumerical Algorithms. Chapter 3.3.4 The Spectral Test, Page 107. Addison-Wesley 1997.

Crossrefs

Cf. A096550-A096561 for other pseudo-random number generators.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          irem(65539 *a(n-1), 2147483648))
        end:
    seq(a(n), n=1..30);  # Alois P. Heinz, Jun 10 2014
  • Mathematica
    NestList[Mod[#*65539, 2^31] &, 1, 50] (* Paolo Xausa, Aug 29 2024 *)
  • PARI
    a(n)=lift(Mod(65539,2^31)^(n-1)) \\ Charles R Greathouse IV, Jan 13 2016

Formula

a(1)=1, a(n) = 65539*a(n-1) mod 2^31. The sequence is periodic with period length 2^29.

A357907 The internal state of the Sinclair ZX81 and Spectrum random number generator.

Original entry on oeis.org

1, 149, 11249, 57305, 38044, 35283, 24819, 26463, 18689, 25472, 9901, 21742, 57836, 12332, 7456, 34978, 1944, 14800, 61482, 23634, 3125, 37838, 19833, 45735, 22275, 32274, 61292, 9384, 48504, 33339, 10093, 36142, 23707, 8600, 55241, 14318, 25332, 64938, 20686, 44173, 36199, 27982
Offset: 1

Views

Author

Jacques Basaldúa, Oct 19 2022

Keywords

Comments

The ZX81 had a congruential random number generator with the hardcoded values: x <- (75*x + 74) mod 65537.
This sequence starts with x = 1. The ZX81 had the option to start with a hardware counter.
The sequence has period 2^16. - Rémy Sigrist, Oct 20 2022
The ZX81 returned these values divided by 65536 as floating-point numbers, however, the seed was set as an integer using RAND (or RANDOMIZE on the ZX Spectrum). To produce the sequence as given here on the ZX81, set the seed with RAND 25340 (the last value in the period before it returns to 1), then print successive values with PRINT 65536*RND. On the ZX81, the current seed was stored in memory locations 16343 and 16384, and could be retrieved with PRINT 256*PEEK 16435+PEEK 16434 (which is equivalent to PRINT 65536*RND, but does not trigger stepping to the next value). - Sean A. Irvine, May 08 2025

Crossrefs

Programs

  • Mathematica
    NestList[Mod[75*# + 74, 65537] &, 1, 50] (* Paolo Xausa, Oct 03 2024 *)
  • PARI
    my(c=Mod(75,65537)); a(n) = lift(2*c^(n-1) - 1); \\ Kevin Ryde, Oct 22 2022
    
  • Python
    def a(n): return (2*pow(75, n-1, 65537) - 1)%65537
    print([a(n) for n in range(1, 43)]) # Michael S. Branicky, Oct 23 2022
  • R
    x <- 1
    nxt <- function(x) (75*x + 74) %% 65537
    for (t in 1:1000) {
      cat(sprintf('%i, ', x))
      x <- nxt(x)
    }
    

Formula

a(n) = (75*a(n-1) + 74) mod 65537, a(1) = 1.
a(n + 2^16) = a(n). - Rémy Sigrist, Oct 20 2022
a(n) = (2*75^(n-1) - 1) mod 65537. - Kevin Ryde, Oct 20 2022
a(n) = a(n-1) - a(n-32768) + a(n-32769) for n > 32769. - Ray Chandler, Aug 03 2023
Previous Showing 21-30 of 70 results. Next