[go: up one dir, main page]

login
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.
3
1, 1103527590, 377401575, 662824084, 1147902781, 2035015474, 368800899, 1508029952, 486256185, 1062517886, 267834847, 180171308, 836760821, 595337866, 790425851, 2111915288, 1149758321, 1644289366, 1388290519, 1647418052, 1675546029
OFFSET
1,2
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.
LINKS
FORMULA
a(1)=1, a(n) = (1103515245 * a(n-1) + 12345) mod 2^31.
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 *)
PROG
(PARI) a(n) = if(n<2, 1, (1103515245 * a(n-1) + 12345) % (2^31));
vector(100, n, a(n)) \\ Altug Alkan, Oct 05 2015
(Magma) [n eq 1 select 1 else (1103515245 * Self(n-1) + 12345) mod (2^31): n in [1..25]]; // Vincenzo Librandi, Oct 06 2015
CROSSREFS
Cf. A096550-A096561 for other pseudo-random number generators.
Sequence in context: A108322 A108323 A154474 * A104924 A272029 A095425
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Jul 18 2004
STATUS
approved