lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Philippe Verdy <verdyp@gmail.com> 于2020年5月26日周二 上午1:18写道:

> And as I said, Mersenne primes are not the best primes for the constant factor: it is only a workaround solution for very small devices that don't have a fast multiplication of two integers. you should use a prime that has alternates the highest number of sequences of 1 and sequences of 0 (ideally a binary number of the form "101010...101" and only if it is a prime.

> * 0b1010_1010_1010_1011 = 0xAAAB = 43691 : IT IS A PRIME ! (see https://primes.utm.edu/lists/small/10000.txt)

Is the form "...011011" a better choice ? It has more "1" in the
binary number, and the longest number of sequences of 1 is two. I
think the form "011" means 2 times of addition.

0b1011011011011011 = 0xB6Db = 46811 : It is a prime , too.