![]() |
|
|
#595 |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
949710 Posts |
7 more
1176774 690642 1179288 372402 1267152 315636 1311728 1093928 1344648 1112448 1454880 722064 1618830 1201808 |
|
|
|
|
|
#596 | |
|
"Robert Gerbicz"
Oct 2005
Hungary
5CE16 Posts |
Quote:
Code:
1382088 28008 |
|
|
|
|
|
|
#597 |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
251916 Posts |
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);
}
Last fiddled with by Batalov on 2017-11-19 at 15:44 Reason: (>4Mb zip file didn't attach; recompressed with 7z) |
|
|
|
|
|
#598 |
|
"Robert Gerbicz"
Oct 2005
Hungary
2·743 Posts |
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)}
(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. Last fiddled with by R. Gerbicz on 2017-11-19 at 18:39 Reason: updated the code |
|
|
|
|
|
#599 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
1C3516 Posts |
Why is GP nearly as illegible as Perl
|
|
|
|
|
|
#600 |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
9,497 Posts |
|
|
|
|
|
|
#601 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
|
|
|
|
|
|
#602 |
|
"Rich"
Aug 2002
Benicia, California
23·3·5·11 Posts |
1382232 terminates at i3532. It merges with 1262272 at i3429.
|
|
|
|
|
|
#603 | |
|
Jun 2003
10011110111112 Posts |
Quote:
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)
}
|
|
|
|
|
|
|
#604 | |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3×29×83 Posts |
Quote:
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]))
Code:
bill@Gravemind ~/mfaliquot $ time ./gp_ali.py in.txt "10**15" ... ... real 88m24.983s user 87m37.980s sys 0m46.180s Last fiddled with by Dubslow on 2017-11-20 at 06:04 Reason: i accidentally a word |
|
|
|
|
|
|
#605 | |
|
"Robert Gerbicz"
Oct 2005
Hungary
101110011102 Posts |
Quote:
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 |
|
|
|
|
![]() |
| Thread Tools | |
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 |