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

A096558 Output of the linear congruential pseudo-random number generator rand() used in Microsoft's Visual C++.

Original entry on oeis.org

0, 38, 7719, 21238, 2437, 8855, 11797, 8365, 32285, 10450, 30612, 5853, 28100, 1142, 281, 20537, 15921, 8945, 26285, 2997, 14680, 20976, 31891, 21655, 25906, 18457, 1323, 28881, 2240, 9725, 32278, 2446, 590, 840, 18587, 16907, 21237, 23611, 12617
Offset: 1

Views

Author

Hugo Pfoertner, Jul 21 2004

Keywords

Crossrefs

Cf. A096557 corresponding internal states. A096550-A096561 other pseudo-random number generators.

Programs

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

Formula

b(1)=0, b(n)=(b(n-1) * 214013 + 2531011) mod 2^32. a(n) = (floor(b(n)/65536) mod 32768). The sequence is periodic with period length 2^32.
a(n) = floor(A096557(n)/2^16) mod 2^15 = floor((2531011*(214013^(n-1)-1)/214012 mod 2^32)/2^16) mod 2^15. - M. F. Hasler, May 14 2015

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

A384331 Consecutive internal states of a linear congruential pseudo-random number generator for Microsoft C and C++ when started at 1.

Original entry on oeis.org

1, 2745024, 1210316419, 415139642, 1736732949, 1256316804, 1030492215, 752224798, 1924036713, 1766988168, 1603301931, 373929026, 1844513277, 1525789900, 1102819423, 652855718, 32201169, 196285776, 782671571, 316395082, 356309989, 2122833684, 957108615
Offset: 1

Views

Author

Sean A. Irvine, May 28 2025

Keywords

Comments

Periodic with period 2^31.
Also used by Microsoft Quick C.

Crossrefs

Cf. A384289 (24-bit modulus), A096557 (32-bit modulus).

Programs

  • Magma
    [n le 1 select 1 else (214013 * Self(n-1) + 2531011) mod 2^31: n in [1..30]]; // Vincenzo Librandi, May 29 2025
  • Mathematica
    NestList[Mod[214013*#+2531011,2^31]&,1,27] (* Vincenzo Librandi, May 29 2025 *)

Formula

a(n) = (214013 * a(n-1) + 2531011) mod 2^31.
Showing 1-3 of 3 results.