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
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1000 terms from Harvey P. Dale)
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
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Jul 18 2004
STATUS
approved