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.

Showing 1-10 of 10 results.

A096550 Consecutive internal states of the IMSL pseudo-random number generator RNUN when started with ISEED=1.

Original entry on oeis.org

1, 16807, 282475249, 1622650073, 984943658, 1144108930, 470211272, 101027544, 1457850878, 1458777923, 2007237709, 823564440, 1115438165, 1784484492, 74243042, 114807987, 1137522503, 1441282327, 16531729, 823378840, 143542612, 896544303, 1474833169, 1264817709, 1998097157
Offset: 1

Views

Author

Hugo Pfoertner, Jul 18 2004

Keywords

Comments

This generator is also called "The minimal standard generator" or LCG16807 by L'Ecuyer. Generators of this form are ascribed to D. H. Lehmer, first described by Hutchinson and independently by Downham and Roberts (see link). It was first analyzed by Lewis, Goodman and Miller (see link).
Also used by Lotus 1-2-3 and some versions of APL. - Sean A. Irvine, May 27 2025

References

  • D. W. Hutchinson, A new uniform pseudo-random number generator. Comm, ACM 9, No. 6, 432-433, 1966.
  • D. E. Knuth, The Art of Computer Programming Third Edition. Vol. 2 Seminumerical Algorithms. Chapter 3.3.4 The Spectral Test, Page 108. Addison-Wesley 1997.

Crossrefs

Cf. A096551-A096561 (other pseudo-random number generators); A061364, A384406.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n,
          irem(16807 *a(n-1), 2147483647))
        end:
    seq(a(n), n=1..30);  # Alois P. Heinz, Jun 10 2014
  • Mathematica
    NestList[Mod[#*16807, 2^31 - 1] &, 1, 50] (* Paolo Xausa, Aug 29 2024 *)
  • PARI
    A096550(n)=lift(Mod(16807,1<<31-1)^(n-1)) \\ M. F. Hasler, May 14 2015

Formula

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

A096561 Consecutive internal states of the second of the two linear congruential random number generators whose combined output is used in function RANDOM_NUMBER in version 8 of the Intel FORTRAN Compiler for Linux, using its intrinsic initialization.

Original entry on oeis.org

2147483398, 2147442707, 491644535, 44073136, 275411947, 1494571342, 367188984, 1612130085, 1622029567, 724872099, 810967243, 1649143122, 223185073, 139696145, 126975187, 29251410, 592572674, 1023646436, 1632766708, 1701483674, 1908878648, 1615402586, 1642669521
Offset: 1

Views

Author

Hugo Pfoertner, Aug 13 2004

Keywords

Comments

This is part 2 of a combined pseudorandom number generator proposed by Pierre L'Ecuyer. For more information, references and links see A096560. For the spectral properties see Table 1, line 21, on page 106 of Knuth's TAOCP Vol. 2.
This sequence has period 2^31 - 250. - Charles R Greathouse IV, Sep 10 2015

References

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

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=1, 2147483398,
          irem(40692 *a(n-1), 2147483399))
        end:
    seq(a(n), n=1..30);  # Alois P. Heinz, Jun 10 2014
  • Mathematica
    NestList[Mod[#*40692, 2^31 - 249] &, 2^31 - 250, 50] (* Paolo Xausa, Aug 29 2024 *)
  • PARI
    a(n)=lift(-Mod(40692,2147483399)^(n-1)) \\ M. F. Hasler, May 14 2015

Formula

a(1)=2^31-250, a(n)=40692*a(n-1) mod (2^31-249).

A084277 Pseudo-random numbers: Davenport's generator for 32-bit integers.

Original entry on oeis.org

10904, 21520, 20895, 25213, 7963, 32668, 25961, 6826, 13530, 17404, 5948, 5449, 8262, 14606, 10788, 30720, 31758, 4871, 32173, 13874, 11466, 27821, 31595, 8091, 15213, 16731, 31046, 17581, 21096, 21170, 7302, 19629, 18847, 30239, 2465, 6541
Offset: 0

Views

Author

Frank Ellermann, May 25 2003

Keywords

Comments

Davenport recommends b(n) as generator, a(n) uses bits 16..30 of b(n).

References

  • H. Davenport, The Higher Arithmetic, 7th ed. 1999, Cambridge University Press, ch. 8.3.

Crossrefs

Cf. A084276, A084277, A061364 (for other versions).
Cf. A382684 (b(n)).

Programs

  • C
    #include 
    unsigned next= 1; int i= 0;
    int main() { while (i++ < 36) next = next * 2147001325 + 715136305, printf( "%d ", (next/65536) % 32768 ); }

Formula

b(n) = b(n-1) * 2147001325 + 715136305, b(0) = 1, a(n) = (( b(n)/(2^16) ) mod (2^15)).

A260083 Consecutive numbers generated by the 'random' function in PARI (32 bit, version > 2.4) using the default argument (2^31).

Original entry on oeis.org

326511477, 1362174608, 903267448, 656347688, 1853455872, 693790135, 1743812782, 1381849689, 1919384312, 561030593, 610902088, 1730365257, 1381380589, 1437333698, 1880143150, 1861285526, 135271255, 2062787134, 476812016, 748713098, 702275007, 1351923632
Offset: 1

Views

Author

Felix Fröhlich, Jul 15 2015

Keywords

Comments

These are the values the function generates in PARI/GP v 2.7.0, using Richard Brent's XORGEN algorithm.
For all n, 0 < a(n) < 2^31.
All 32-bit PARI versions > 2.4 should yield this sequence of pseudo-random numbers, when the random generator is in its initial state or reset to that state using setrand(1). - M. F. Hasler, Sep 18 2016
The generator has a period of 2^4096-1. - Hugo Pfoertner, Sep 18 2016

Crossrefs

Cf. A276820: Corresponding 64 bit random number generator.

Programs

  • PARI
    a(n) = random \\ Works only if called first with n=1, then with n=2, etc, and if the internal random generator was never called before or reset via setrand(1)
    
  • PARI
    setrand(1); A260083=vector(100,i,random()) \\ M. F. Hasler, Sep 18 2016

A084276 Pseudo-random numbers: gcc 2.6.3 version for 32-bit integers.

Original entry on oeis.org

1, 7261, 13503, 15223, 8047, 88, 29253, 1572, 18740, 14060, 25029, 21260, 21203, 8054, 14922, 1084, 23230, 9538, 15465, 24014, 1274, 13434, 20285, 1973, 18297, 3025, 8994, 27214, 8752, 5869, 5683, 29094, 24317, 15766, 22147, 906, 13626, 21410, 32284, 13393, 27934
Offset: 0

Views

Author

Frank Ellermann, May 25 2003

Keywords

Crossrefs

Cf. A084275, A084277, A061364 (other versions).
Cf. A385127 (internal state).

Programs

  • C
    #include 
    unsigned next= 1; int i= 0;
    int main() { while (i++ < 37) next= next *69069 +5, printf( "%d ", (unsigned)( next >> 16) & 0x7FFF ); }

Formula

a(n) = floor(A385127(n + 1) / 2^16) mod 2^15. - Sean A. Irvine, Jun 18 2025

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.

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

A084275 Pseudo-random numbers: MS C 6.0 version.

Original entry on oeis.org

41, 18467, 6334, 26500, 19169, 15724, 11478, 29358, 26962, 24464, 5705, 28145, 23281, 16827, 9961, 491, 2995, 11942, 4827, 5436, 32391, 14604, 3902, 153, 292, 12382, 17421, 18716, 19718, 19895, 5447, 21726, 14771
Offset: 0

Views

Author

Frank Ellermann, May 20 2003

Keywords

Crossrefs

Programs

  • C
    #include 
    int main()
    {
        long next = 1;
        int i = 0;
        while ( i++ < 33 )
        {
            next = next * 214013L + 2531011L;
            printf( "%d ", (unsigned)( next >> 16) & 0x7FFF );
        }
        printf("\n");
        return 0;
    }

Formula

a(n) = A096558(n+199670977) = floor((A096557(n+199670977) mod 2^31)/2^16). - Zhuorui He, Aug 22 2025

Extensions

Corrected by Alan Klette, Jun 09 2019

A096554 Output of the linear congruential pseudo-random number generator used in function rand() as described in Kernighan and Ritchie, when seeded with 0.

Original entry on oeis.org

0, 21468, 9988, 22117, 3498, 16927, 16045, 19741, 12122, 8410, 12261, 27052, 5659, 9758, 21087, 25875, 32368, 26233, 15212, 17661, 20496, 8191, 23065, 23471, 32096, 10781, 14596, 23212, 24244, 5661, 514, 25643, 1350, 19576, 8051, 18234, 16882, 13023, 5983, 21166
Offset: 1

Views

Author

Hugo Pfoertner, Jul 18 2004

Keywords

Comments

This sequence and A061364 are generated by the same algorithm but with different seed: A061364 (as well as A096553 which is the sequence of internal states of the generator) has seed 1, while this sequence has seed 0. [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, page 46.

Crossrefs

Cf. A096550-A096561 for other pseudo-random number generators.
A061364 is the same generator seeded with 1.

Programs

  • C
    static unsigned int next = 0; int rand( ) { next = next * 1103515245 + 12345; return ((next >>16) & 32767); }
    
  • Mathematica
    BitShiftRight[NestList[Mod[#*1103515245 + 12345, 2^31] &, 12345, 50], 16] (* Paolo Xausa, Aug 29 2024 *)
  • PARI
    x(n) = if(n<1, 0, (1103515245 * x(n-1) + 12345) % (2^31));
    vector(100, n, floor(x(n)/2^16)) \\ Altug Alkan, Oct 05 2015

Formula

Correction of seed value and second formula from David Fifield, May 23 2024: (Start)
x(0) = 0, x(n) = (1103515245 * x(n-1) + 12345) mod 2^31, a(n) = floor(x(n)/2^16).
a(n) = A061364(n + 1212780038). (End)

Extensions

Name amended (start at 0) by David Fifield, May 23 2024

A096559 Consecutive states of a linear congruential pseudo-random number generator that has the spectrally best primitive root for 2^31-1 as multiplier.

Original entry on oeis.org

1, 62089911, 847344462, 1061653656, 1954074819, 226824280, 953102500, 1452288378, 50913524, 2133871779, 1843965925, 427233754, 195855103, 1546822229, 1652729917, 1636805220, 217994169, 1312006067, 208869911, 310792805, 675992938, 1109700100, 855351136, 863373758
Offset: 1

Views

Author

Hugo Pfoertner, Aug 14 2004

Keywords

Comments

The results of the spectral tests for this generator are given in line 18 of Table 1 in D. Knuth's TAOCP vol. 2, page 106.

References

  • G. A. Fishman, L. R. Moore III; An exhaustive analysis of multiplicative congruential random number generators with modulus 2^31-1. SIAM Journal on Scientific and Statistical Computing, Volume 7, Issue 1 (1986), 24-45. Erratum, ibid, Vol. 7, Issue 3 (1986) p. 1058.
  • D. E. Knuth, The Art of Computer Programming Third Edition. Vol. 2 Seminumerical Algorithms. Chapter 3.3.4 The Spectral Test, Page 108. Addison-Wesley 1997.

Crossrefs

Programs

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

Formula

a(1)=1, a(n)=62089911*a(n-1) mod (2^31-1).
Showing 1-10 of 10 results.