mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Aliquot Sequences

Reply
Thread Tools
Old 2017-11-19, 15:32   #595
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

9,497 Posts
Default

7 more

1176774 690642
1179288 372402
1267152 315636
1311728 1093928
1344648 1112448
1454880 722064
1618830 1201808
Batalov is offline   Reply With Quote
Old 2017-11-19, 15:36   #596
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

2×743 Posts
Default

Quote:
Originally Posted by Dubslow View Post




How on earth did you do that? I count 405 mergers in your data, which includes 36 that had already been detected. What are your methods? How long did it take? Had you been doing local calculations in the early/low portions of the various seqs, or have you solely been massaging the rechenkraft data? (AllSeq.txt doesn't even have IDs! Though I suppose string comparison on the factors lines would have been just as good.) If the latter, what massaging? How much have you queried the FDB?
Zero factordb queries, just a simple single threaded Pari-Gp code using the starting values from AllSeq.txt, it took roughly 25 minutes, working from scratch. When raised the limit to 10^40 surprisingly it has found only one more collision in 2 hours:
Code:
1382088 28008
but it has been already deleted from the newer AllSeq.txt file.
R. Gerbicz is offline   Reply With Quote
Old 2017-11-19, 15:40   #597
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

9,497 Posts
Default All trivial merges up to 2M at 12-digit level

Here is my code (one can rerun it with M=1e13 if you want to find more trivial merges).
Code:
# gp

% too lazy to detect cycles, so "for(i=0,100,"

M=10^12;forstep(x=2,2000000,2,a=x;for(i=0,100,s=sigma(a)-a;write("ALL_10_12",x" "s);if(s==a||s>M||s<=x,break);a=s))
% or
M=10^12;for(x=2,2000000,a=x;for(i=0,100,s=sigma(a)-a;write("ALL_1e12",x" "s);if(s==a||s>M||s<=x,break);a=s))
Code:
awk '{if($1<$2){print} else {print $2, $1}}' ALL_1e12 |sort -n |uniq > ALL_1e12a
Code:
_merger.pl
#!/usr/bin/perl -w

open IN, "<ALL_1e12a";
while(<IN>) {
  /(\d+) (\d+)/;
  if($B{$2} && $B{$2} < $1) {
    $B{$1} = $B{$2};
  } else {
    $B{$2} = $1;
  }
}
close IN;

for($i=4;$i<=2000000;$i+=2) {
  print $i, " ",$B{$i}, "\n" if ($B{$i} && $B{$i} <= $i);
}
All trivial merges up to 2M at 12-digit level are attached.
Attached Files
File Type: 7z ALLmerged2M_1e12.7z (3.46 MB, 69 views)

Last fiddled with by Batalov on 2017-11-19 at 15:44 Reason: (>4Mb zip file didn't attach; recompressed with 7z)
Batalov is offline   Reply With Quote
Old 2017-11-19, 18:31   #598
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

2·743 Posts
Default

My used Pari-Gp code was:

Code:
allocatemem(10^8);
ffun(filename,B)={v=vecsort(readvec(filename));L=length(v);T=vector(L);nc=0;for(i=1,L,n=v[i];
print("Test n=",n,"; collisions=",nc);while(n<B,n=sigma(n)-n;if(n>=B,T[i]=n;
for(j=1,i-1,if(n==T[j],write("merges.txt",v[i]" "v[j]);print(v[i]" "v[j]);
nc+=1;break()));break())));return(nc)}
Call it for example: ffun("in.txt",10^50) where the first parameter is the master file, one starting number per line, sorted in increasing order; since we read the file by readvec this input format is strict. The second number is the search limit.
(You can try it using a smaller input file, containing some trivial collision(s).)
Attached the sample in.txt file for n<2M. I've already done it with ffun("in.txt",10^40).
The collisions saved to merges.txt file, also printed to screen.
Attached Files
File Type: txt in.txt (135.4 KB, 152 views)

Last fiddled with by R. Gerbicz on 2017-11-19 at 18:39 Reason: updated the code
R. Gerbicz is offline   Reply With Quote
Old 2017-11-19, 19:37   #599
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

1C3516 Posts
Default

Why is GP nearly as illegible as Perl
Dubslow is offline   Reply With Quote
Old 2017-11-19, 20:02   #600
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

9,497 Posts
Default

Quote:
Originally Posted by Dubslow View Post

How on earth did you do that?
Quote:
Originally Posted by Dubslow View Post
Why is GP nearly as illegible as Perl?
These questions are ultimately connected.
Batalov is offline   Reply With Quote
Old 2017-11-19, 20:15   #601
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3×29×83 Posts
Default

Quote:
Originally Posted by Batalov View Post
These questions are ultimately connected.
PARI has a Python frontend in the Sage package, unfortunately Sage still isn't py3k compatible Soon™!
Dubslow is offline   Reply With Quote
Old 2017-11-20, 00:51   #602
richs
 
richs's Avatar
 
"Rich"
Aug 2002
Benicia, California

23·3·5·11 Posts
Default

1382232 terminates at i3532. It merges with 1262272 at i3429.
richs is offline   Reply With Quote
Old 2017-11-20, 03:23   #603
axn
 
axn's Avatar
 
Jun 2003

2·2,543 Posts
Default

Quote:
Originally Posted by Dubslow View Post
Why is GP nearly as illegible as Perl
Quote:
Originally Posted by Dubslow View Post
PARI has a Python frontend in the Sage package, unfortunately Sage still isn't py3k compatible Soon™!
How about now? Is this really inferior to Python?
Code:
allocatemem(10^8);
ffun(filename,B)=
{
	v=vecsort(readvec(filename));
	L=length(v);
	T=vector(L);
	nc=0;
	for(i=1,L,
		n=v[i];
		print("Test n=",n,"; collisions=",nc);
		while(n<B,
			n=sigma(n)-n;
			if(n>=B,
				T[i]=n;
				for(j=1,i-1,
					if(n==T[j],
						write("merges.txt",v[i]" "v[j]);
						print(v[i]" "v[j]);
						nc+=1;
						break()
					)
				);
				break()
			)
		)
	);

	return(nc)
}
axn is online now   Reply With Quote
Old 2017-11-20, 06:03   #604
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

722110 Posts
Default

Quote:
Originally Posted by axn View Post
How about now? Is this really inferior to Python?
Code:
allocatemem(10^8);
ffun(filename,B)=
{
	v=vecsort(readvec(filename));
	L=length(v);
	T=vector(L);
	nc=0;
	for(i=1,L,
		n=v[i];
		print("Test n=",n,"; collisions=",nc);
		while(n<B,
			n=sigma(n)-n;
			if(n>=B,
				T[i]=n;
				for(j=1,i-1,
					if(n==T[j],
						write("merges.txt",v[i]" "v[j]);
						print(v[i]" "v[j]);
						nc+=1;
						break()
					)
				);
				break()
			)
		)
	);

	return(nc)
}
That's much better, thanks! I'm figuring out thanks to your indentation that commas and semicolons inside loops have the opposite meaning from what they have in C.

Here's a rough equivalent in Python, if anyone wants to compare. Of course the major disadvantage of Python is that it doesn't offer any functions for number theory, so it uses the crappy sigma I rolled long ago for the blue page. (Sage uses Pari among many other fast backends, so Python+Sage would not have the same problem, though as before, Sage doesn't quite yet support modern Python versions.)

Code:
#! /usr/bin/env python3

from collections import defaultdict

from mfaliquot.theory.numtheory import sigma
# ^ shitty hand rolled python, much slower than pari
# if/when sage supports python3, it would be as fast as pari

def ffun(filename, B):

     with open(filename) as f:
          v = list(sorted(int(line) for line in f))

     T = defaultdict(list)
     nc = 0

     for seq in v:
          print("Test seq=", seq, "; collisions=", nc)
          n = seq
          while n < B:
               n = sigma(n) - n
               if n >= B:
                    l = T[seq]
                    if l:
                         nc += 1
                         with open("merges.txt", 'w') as f:
                              f.write("{} {}".format(seq, n))
                    l.append(n)
                    break

     return nc

if __name__ == '__main__':
     from sys import argv
     ffun(argv[1], eval(argv[2]))
The defaultdict(list) is exactly what the blue page uses as well to find mergers. I had thought the equivalent search for trivial merges like this had already been done, otherwise I would have done it myself. At least we'll be prepared when further extensions come.

Code:
bill@Gravemind ~/mfaliquot $ time ./gp_ali.py in.txt "10**15"
...
...
real	88m24.983s
user	87m37.980s
sys	0m46.180s
Can confirm no collisions and also slow as ****

Last fiddled with by Dubslow on 2017-11-20 at 06:04 Reason: i accidentally a word
Dubslow is offline   Reply With Quote
Old 2017-11-20, 08:23   #605
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

2·743 Posts
Default

Quote:
Originally Posted by Dubslow View Post
PARI has a Python frontend in the Sage package, unfortunately Sage still isn't py3k compatible Soon™!
Pari is available in Linux and Windows also.

Small note to the above ffun() routine: it is assuming that all sequences in the file reach the B bound, if it is not true, then there'll be an infinite loop. (It wouldn't be that hard to modify it to handle this also.)

Last fiddled with by R. Gerbicz on 2017-11-20 at 08:23
R. Gerbicz is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reserved for MF - Sequence 276 kar_bon Aliquot Sequences 127 2020-12-17 10:05
Primes in n-fibonacci sequence and n-step fibonacci sequence sweety439 And now for something completely different 17 2017-06-13 03:49
Figuring Out Sequence Merges Jayder Aliquot Sequences 13 2014-05-30 05:11
Novice Questions About Merges EdH Aliquot Sequences 4 2010-04-13 19:43
A New Sequence devarajkandadai Math 3 2007-03-20 19:43

All times are UTC. The time now is 09:56.


Fri Aug 6 09:56:34 UTC 2021 up 14 days, 4:25, 1 user, load averages: 4.27, 4.34, 4.09

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.