A357907 The internal state of the Sinclair ZX81 and Spectrum random number generator.
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
Links
- Jianing Song, Table of n, a(n) for n = 1..65536
- B. D. Ripley, Computer Generation of Random Variables: A Tutorial, International Statistical Review, 51 (1983), 301-309.
- W. E. Sharp and Carter Bays, A review of portable random number generators, Computers and Geosciences, 18, 1 (1982), 79-87.
- Wikipedia, Linear congruential generator.
- Index entries for linear recurrences with constant coefficients, order 32769.
- Index entries for sequences related to pseudo-random numbers.
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
Comments