mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2018-05-28, 13:55   #1
irina
 
Jul 2015

22 Posts
Lightbulb algorithm for factoring a number into two factors

var k,l,n,s,j,d,c,y,r,b:biginteger;
begin
var x:=ReadString('введите число:').ToBigInteger;
var a:=x div 2;
repeat
b:=a;
a:=(a+x div a)div 2
until a>=b;
s:=a;
n:=x-sqr(s);
k:=n div s; j:=n mod s; l:=s+k; d:= s-j;
repeat
s:=s-1;
d:=d-1;
r:=l-d;
c:=r div s;
y:=r mod s;
l:=l+1+c;
j:=y;
d:=s-j;
until j=0;
writeln('l=',l); writeln ('s=',s);
end.
irina is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Factoring Algorithm GreasyScooby Factoring 4 2018-04-27 13:48
Number of distinct prime factors of a Double Mersenne number aketilander Operazione Doppi Mersennes 1 2012-11-09 21:16
Estimating the number of prime factors a number has henryzz Math 7 2012-05-23 01:13
Prime Factoring Algorithm Visu Math 66 2008-05-12 13:55
Faster Factoring Algorithm? Citrix Factoring 6 2007-12-23 11:36

All times are UTC. The time now is 03:06.

Tue Oct 20 03:06:26 UTC 2020 up 40 days, 17 mins, 0 users, load averages: 2.28, 1.86, 1.80

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, 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.