mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > ONeil

Reply
 
Thread Tools
Old 2020-12-30, 08:19   #1
ONeil
 
Dec 2017

24·3·5 Posts
Thumbs up Sorry about last post I hope u like this new factor method

I have found that ratios of numbers are related to factors of numbers in the form of 2^n-1.

Go here:
https://goodcalculators.com/ratio-calculator/

Now put in 1:37 and check number 6 its 222 add 1 and you get the factor for 2^37-1.




So I built my factoring code in python around that premise, based on ratios. It can process 2^67-1 in 9 seconds. 2^101-1 is still slow, because its a big factor.

HAPPY NEW YEAR, My Apologies everyone for all the crap you have had to deal with from me if I pissed you off in 2020. I hope to be better in 2021.



Code:
from decimal import *
from math import floor, sqrt

import time
while True:
	def isqrt(n):
		
		x = n
		y = (x + 1) // 2
		while y < x:
			x = y
			y = (x + n // x) // 2
		return x
		n = (floor(n))
	start_time = time.time()
	
	b = int(input(' Enter a number: '))
	s = (pow(2,b-1)*2-1)
	  
	
	n = (((isqrt(s))))
	for x in range(1,n):
		if (pow(2,b-1)*2-1)%(b*x+1) ==0:
			print(b*x+1,'This is the factor of a number 2^number-1')
			e = int(time.time() - start_time)
			print('{:02d}:{:02d}:{:02d}'.format(e // 3600, (e % 3600 // 60), e % 60))
			break
ONeil is offline   Reply With Quote
Old 2020-12-30, 08:51   #2
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

6,143 Posts
Default

No need for such complication.

I guarantee this is faster:
Code:
p = 67
k, n = 1, 1 << p
while k * k < n:
	k += p + p
	if pow(2, p, k) == 1:
		print(k)
		break
retina is online now   Reply With Quote
Old 2021-01-02, 16:46   #3
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

22·17·139 Posts
Default

Quote:
Originally Posted by ONeil View Post
HAPPY NEW YEAR, My Apologies everyone for all the crap you have had to deal with from me if I pissed you off in 2020. I hope to be better in 2021.
Better crap? What we hope is not to be better, but to disappear.
LaurV is offline   Reply With Quote
Old 2021-01-02, 17:02   #4
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

7·372 Posts
Default

Quote:
Originally Posted by LaurV View Post
Better crap? What we hope is not to be better, but to disappear.
Here is a tip/challenge/request to the OP.

Don't post anything more until your very slow LL test completes.

Spend the time on seeing why the current factoring methods are better than anything you come up with. Python might be a fun language to play with, but if you are worried about how to factor quickly, you will need to learn a language that is closer to the metal and compiles. If you want to find factors for Mersenne numbers, look at all the work that has been done to exclude candidate factors. And look at the ways that previous tests have used smart programming to speed up tests. Then look at how programs like Prime95 exploit advanced CPU instructions to further speed things up.
Uncwilly is online now   Reply With Quote
Old 2021-01-02, 20:01   #5
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

2·2,273 Posts
Default

Quote:
Originally Posted by Uncwilly View Post
Here is a tip/challenge/request to the OP.

Don't post anything more until your very slow LL test completes.
I can relate.
Dr Sardonicus is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there hope for the GPU shortage on the horizon? tServo GPU Computing 15 2018-03-08 22:20
Hope I'm not OT... ET_ Linux 14 2016-11-01 15:46
Finding Cancer Hope in a Toxic Wasteland ewmayer Science & Technology 62 2007-11-11 04:05
Fermat's Last Theorem: a new hope ET_ Math 36 2005-11-10 22:15
Post the numbers you have tried to factor here hyh1048576 Factoring 11 2003-12-01 07:37

All times are UTC. The time now is 16:21.

Sun May 16 16:21:42 UTC 2021 up 38 days, 11:02, 1 user, load averages: 4.77, 3.44, 2.66

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.