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-5 of 5 results.

A061364 Pseudo-random numbers: a (very weak) pseudo-random number generator from the second edition of the C book.

Original entry on oeis.org

16838, 5758, 10113, 17515, 31051, 5627, 23010, 7419, 16212, 4086, 2749, 12767, 9084, 12060, 32225, 17543, 25089, 21183, 25137, 25566, 26966, 4978, 20495, 10311, 11367, 30054, 17031, 13145, 19882, 25736, 30524, 28505, 28394
Offset: 0

Views

Author

Frank Ellermann, Jun 11 2001

Keywords

Comments

WATCOM C/C++ 10.0b uses this sequence for stdlib.h rand(). MS C 6.0 and gcc 2.6.3 use other (similar) sequences.

References

  • Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, Second Edition, ANSI C, 1988, Prentice-Hall Internat., ch. 2.7.
  • Brian W. Kernighan and Dennis M. Ritchie, The C-programming-language [German], 1990, Hanser, p. 45.

Crossrefs

A096554 is the same sequence seeded with 0.

Programs

  • C
    unsigned long next= 1; int i= 0; while (i++ < 33) next= next * 1103515245 + 12345, printf( "%d ", (unsigned)( next/65536 ) %32768 );
    
  • PARI
    x=1; m=2^32; for (n=0, 1000, x=(x*1103515245 + 12345)%m; write("b061364.txt", n, " ", (x\65536)%32768) ) \\ Harry J. Smith, Jul 21 2009

Formula

From David Fifield, May 23 2024: (Start)
a(n) = A096554(n+934703610).
a(n) = floor(A096553(n+2)/65536) mod 32768. (End)

A035331 Base-1000 expansion of Pi.

Original entry on oeis.org

3, 141, 592, 653, 589, 793, 238, 462, 643, 383, 279, 502, 884, 197, 169, 399, 375, 105, 820, 974, 944, 592, 307, 816, 406, 286, 208, 998, 628, 34, 825, 342, 117, 67, 982, 148, 86, 513, 282, 306, 647, 93, 844, 609, 550, 582, 231, 725, 359, 408, 128, 481, 117, 450
Offset: 0

Views

Author

Keywords

Comments

Start with a(0)=3; other terms are formed from triples of successive digits in the decimal expansion of Pi.
This sequence can be considered as a (pseudo)random generator with range 0..999. Its scatterplot graph is very similar to that of other random generators, e.g., A096558. - M. F. Hasler, May 14 2015

Examples

			Pi = 3.141 592 653 589 793 238 462 643 383 279 502 884 197 169 399 375 105 ...
		

Crossrefs

Programs

  • Mathematica
    RealDigits[Pi,1000,60][[1]] (* Harvey P. Dale, Nov 22 2015 *)
  • PARI
    default(realprecision,3*N=100);vector(N,i,Pi\1000^(1-i)%1000) \\ or: {P=Pi;vector(N,i,P\1+0*P=frac(P)*1000)} or {P=Pi/1000;vector(N,i,floor(P=frac(P)*1000))}. \\ M. F. Hasler, May 11 2015

Formula

a(n) = floor(Pi*10^(3n)) mod 1000. - M. F. Hasler, May 14 2015

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Oct 04 2001
Better definition from Franklin T. Adams-Watters, Apr 10 2006

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.

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

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
Showing 1-5 of 5 results.