View Single Post
Old 2021-11-22, 14:57   #10
axn
 
axn's Avatar
 
Jun 2003

5×29×37 Posts
Default

Quote:
Originally Posted by R. Gerbicz View Post
I'm not sure what your code is doing
Sorry, I meant to reply to this earlier but somehow slipped my mind.

Anyway, the code computes a cost function of including p^n in the product. It is basically log(p) (i.e proportional to the bits) / probability of p^n dividing a random P-1. i.e. more bits = costlier. Less probable = less useful. This comes out as log(p) * (p-1) * p^(n-1) -> what I call as the merit function.

The code then finds the largest n for each p such that merit(p^n) doesn't exceed the target merit, which is just the cost for a single instance of the largest prime under B1. For comparison, it also prints the count as per the regular method.

Last fiddled with by axn on 2021-11-22 at 14:57
axn is offline   Reply With Quote