# Talk:Lagged Fibonacci generator

## Large number of cycles?

I don't believe that this statement is true, is it?

"any maximum period LFG has a large number of possible cycles, all different"

For example, many M-sequences have only two cycles, one of length 2^N-1, and one of length 1 (the element 0)

I also believe that many additive LFGs have only a very small number of cycles, with extremely long cycles.

## Dubious claim?

"It is important that M be greater than 100 for the additive case"

This isn't true so I've removed it. OoS (talk) 11:49, 22 November 2007 (UTC)

## Reference to The Art of Computer Programming

"Another list of possible values for j and k is on page 28 of volume 2 of The Art of Computer Programming"

Not in the third edition. In the third edition the list is as follows (table 1, page 29):

(24,55), (38,89), (37,100), (30, 127), (83,258), (107,378), (273,607), (1029,2281), (576,3217), (4187,9689), (7083,19937), (9739,23209)

OoS (talk) 17:43, 23 November 2007 (UTC)

The article refers to the second edition of TAOCP. However, this talk page says that it's different in the third edition, but gives the SAME LIST. — Preceding unsigned comment added by 132.244.72.6 (talk) 12:20, 5 June 2013 (UTC)

## Mention of Matlab

Matlab by default now uses the mersenne twister, article needs updating to clarify —Preceding unsigned comment added by 80.3.31.37 (talk) 12:33, 27 September 2010 (UTC)

## Error in definition of the maximum period

In the article you can still find the following wrong information:

Lagged Fibonacci generators have a maximum period of (2k - 1)*2(M-1) if addition or subtraction is used, and (2k-1)*k if exclusive-or operations are used to combine the previous values.

Correct is the following information:

Lagged Fibonacci generators have a maximum period p wich equals the least common multiple of tree factors (p = lcm(a, b, 2c) = product(a, b, 2c) / gcd(a, b, 2c)) where
factor a equals the period of any LFSR(k) using a primitive polynom of degree k, that means (a = 2k-1)
factor b equals the number of stored and accessable values in the lagged fibonacci generator, that means (b = k)
factor c equals the number of bits modified by the carry flag, that means for xor (c = 0) and for add or sub (c = M-1)

used binary operation period of the lagged fibonacci generator
xor p = lcm(2k-1, k, 20)
addition or subtraction p = lcm(2k-1, k, 2M-1)

The following table lists some examples for small values of k and with (M = 8), that means all stored values in the lagged fibonacci generator are only bytes:

k period of LaggedFibonacciGenerator(k, xor) period of LaggedFibonacciGenerator(k, add)
3 21 2.688
4 60 1.920
5 155 19.840
6 126 8.064
7 889 113.792
8 2.040 32.640
... ... ...
12 16.380 524.160
... ... ...
17 2.228.207 285.210.496
18 524.286 33.554.304
19 9.961.453 1.275.065.984
20 4.194.300 134.217.600
21 6.291.453 805.305.984
... ... ...

Legend: (gcd: greatest common divisor; lcm: least common multiple)

--Aragorn321 (talk) 20:37, 15 February 2013 (UTC)

## vandalized page

79.112.127.128 (talk) 21:13, 29 April 2013 (UTC)

Dustr.badalyan (talk) 19:32, 19 May 2013 (UTC)

Dustr.badalyan (talk) 20:38, 21 May 2013 (UTC) — Preceding unsigned comment added by 174.61.207.104 (talk)

## Missing a j,k pair or wrong pair cited?

The section “Properties of lagged Fibonacci generators” list known j,k pairs for parametrization of an LFG. Then section “Problems with LFGs” talks about some known issues with two pairs, which are R(103, 250) and R(24,55). However, only the second pair in cited in the former section; it does not mention the first pair. I wonder: is the first pair missing in the former section or is this an error in the latter section? I'm too much ignorant on the topic to check it myself, so someone else will have to do it; I just wanted to point a potential inconsistency. --Hibou57 (talk) 02:17, 20 July 2013 (UTC)

## Rules for multiplicative LFGs

Knuth, errata to vol 2, pag 7 of http://www-cs-faculty.stanford.edu/~uno/err2-2e.ps.gz:

""" George Marsaglia [Comp. Sci. and Statistics: Symposium on the Interface 16 (1984), 3{10] has suggested replacing ( 7 ) by X(n) = ( X(n - 24) * X(n - 55) ) mod m ( 7 0 ) where m is a multiple of 4 and where X 0 through X 54 are odd, not all congruent to 1 (modulo 4). Then the second-least signicant bits have a period of 2^55 - 1, while the most signicant bits are more thoroughly mixed than before since they depend on all bits of X n 24 and X n 55 in an essential way. """

It makes sense (think about the bits: XXXXX01 * XXXXX01 will never give XXXXX11...), but I can't seem to find the exact reference - anyone? — Preceding unsigned comment added by Useurandom (talkcontribs) 15:02, 4 December 2014 (UTC)