home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,391 of 4,675   
   wolfgang kern to James Van Buskirk   
   Re: Reciprocal MUL LUT   
   06 May 18 13:03:14   
   
   From: nowhere@never.at   
      
   James Van Buskirk wrote:   
   ...   
   >> I check for repeated bit-patterns within any reported peroid and find   
   >> many shorter "binary periods" which can be repeated until any wanted   
   >> precision.   
      
   >> ie: 1/3 period = 4 bits but I see only 2 (01)        0x5..   
   >>     1/7        =12                     3 (001)       0x249..   
   >>     1/31       =20                     5 (00001)     0x08421..   
   >>     1/73       =36                     9 (000000111) 0x0381C0E07..   
      
   >> seems many binary reciprocals of primes are shorter than we assume.   
      
   > The thing is that if for a prime $p$, $1/p$ repeats $n$ digits, then   
   > $$1/p=\sum_{k=1}^{\infty}\frac r{2^{kn}}=r\cdot\frac{2^{-n}}{1-2^{-n}}=   
   > \frac r{2^n-1}$$   
   > Where $0\le r\le2^n-1$, so $2^n-1=rp$ or $2^n\equiv1(\mod p)$. Since   
   > the multiplicative group of units $\mod p$ has order $p-1$ and the order   
   > of any element divides the order of the group, it follows that $n$ is a   
   > divisor of $p-1$. We already know from OEIS A001122 the primes $p$   
   > for which $n=p-1$. $3=2^2-1$, $7=2^3-1$, $31=2^5-1$ are Mersenne primes   
   > with $n=2$, $n=3$, and $n=5$ rather famously. See OEIS A000043.   
      
   Thanks, oh yes I now remember Mersenne (Number-Theory 50 years ago).   
   I could detect and tag them in my sieve already, unfortunately there   
   arent too many of em related to the whole range.   
      
   > If $p\equiv 1(\mod 8)$ or $p\equiv 7(\mod 8)$ it follows by quadratic   
   > reciprocity that $n$ is a divisor of $(p-1)/2$.   
      
   > It's a more difficult problem to find all the primes $p$ corresponding to   
   > a given value of $n$.   
      
   Yeah, and exactly this (beside that I need the reciprocal value in   
   addition to the period size) made me use brute force divide and check.   
   And for a LUT-creation I have to run this only once anyway.   
      
   > The question of $n=512$ came up earlier in the   
   > discussion and there we have   
   > $$2^{512}-1=(2^{256}-1)(2^{256}+1)$$   
      
   > And factors of $2^{256}-1$ have periods that divide $256$ so we only   
   > have to factor the Fermat number   
      
   > $$2^{256}+1=1238926361552897\times   
   > 93461639715357977769163558199606896584051237541638188580280321$$   
   > See OEIS 050922.   
      
   > BTW, to render the above MathJax readable it may be necessary to   
   > paste it into a MathJax viewer such as   
   > http://bandicoot.maths.adelaide.edu.au/MathJax/test/sample-dynamic-2.html   
      
   No problem, even I'm not familiar with this kind of math expression it's   
   enough explaining.   
      
   I may use OEIS suggested mehodes for future expansions and already stored:   
   .3739558136192022880547280543464164151116292486061500   
   42094742802417350182040028082344304317087250568981603   
   and yet added your posted Fermat Number.   
      
   thanks,   
   __   
   wolfgang   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca