Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. def odds_of_factor_between(m, n):
  2.      # Returns the odds that there's a factor with size between m and n digits inclusive
  3.      odds = 0
  4.      for d in range(m, n+1):
  5.           odds += 1/d
  6.      return odds
  7. ...
  8.  
  9. def analyze_ecm_nfs_xover(digit_level, nfs_hours, include_missed_factors=1/2):
  10.      # This assumes that ECM has been run to one full t-level at the digits-5 level
  11.      odds_of_factor = odds_of_factor_between(digit_level-4, digit_level)
  12.      missed_factor_odds = exp(-1) * odds_of_factor_between(digit_level-9, digit_level-5)
  13.      # While the lower level ECM may have missed a factor, there's also a chance for it to find a
  14.      # factor larger than digits-5. In lieu of actually quantifying those odds, we merely fudge off
  15.      # some of the missed factor odds.
  16.      missed_factor_odds *= include_missed_factors
  17.      odds_factor_exists = odds_of_factor + missed_factor_odds