mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-12-22, 14:49   #2102
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

838410 Posts
Default

Code:
a=0;for(i=1,#mersenne,for(x=a+1,100,if(prime(x)==mersenne[i],a=x;break(),print1(x",");a=x;break())))
Basically checking for http://oeis.org/A135980 , but it's not working as intended. I'm using a so x doesn't repeat a value, this seems to work however it reports 6 as the second term not 9 so I've made a major error. doh I should have reversed the order of the loops I think. I see why it prints six because it checks 11==13 and that's false so it prints x then puts 5 in a so it then increments without finding the next match and hence it returns 6 on finding 13!=17.

Last fiddled with by science_man_88 on 2010-12-22 at 14:57
science_man_88 is offline   Reply With Quote
Old 2010-12-22, 14:58   #2103
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Code:
a=0;for(i=1,#mersenne,for(x=a+1,100,if(prime(x)==mersenne[i],a=x;break(),print1(x",");a=x;break())))
Basically checking for http://oeis.org/A135980 , but it's not working as intended. I'm using a so x doesn't repeat a value, this seems to work however it reports 6 as the second term not 9 so I've made a major error. doh I should have reversed the order of the loops I think. I see why it prints six because it checks 11==13 and that's false so it prints x then puts 5 in a so it then increments without finding the next match and hence it returns 6 on finding 13!=17.
note putting a i=i-1 in the if false part worked.
science_man_88 is offline   Reply With Quote
Old 2011-01-03, 16:29   #2104
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Code:
aliquot(x,y)=b=0;v=vector(y);v[1]=x;for(i=2,#v,for(a=1,i-1,if(sigma(v[i-1])-v[i-1]==0 || sigma(v[i-1])-v[i-1]==v[a],break(2),b=b+1;if(b!=a,b=0;break(2),v[i]=sigma(v[i-1])-v[i-1];b=0;break()))))
this seem to work for aliquot checking repeat lol.Now I just have to eliminate the y variable and cleave it to the final length if not less than infinite I think. too bad i can't get it to start at any index already calculated.
science_man_88 is offline   Reply With Quote
Old 2011-01-03, 20:15   #2105
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Code:
aliquot(x,y)=b=0;v=vector(y);v[1]=x;for(i=2,#v,for(a=1,i-1,if(sigma(v[i-1])-v[i-1]==0 || sigma(v[i-1])-v[i-1]==v[a],break(2),b=b+1;if(b!=a,b=0;break(2),v[i]=sigma(v[i-1])-v[i-1];b=0;break()))))
this seem to work for aliquot checking repeat lol.Now I just have to eliminate the y variable and cleave it to the final length if not less than infinite I think. too bad i can't get it to start at any index already calculated.
crap a failure.

Code:
for(x=1,100, print(aliquot(x,5)))
gave 95,25,6,6,6, but it should have terminated after finding the second 6.
science_man_88 is offline   Reply With Quote
Old 2011-01-03, 20:50   #2106
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Code:
aliquot(x,y)=b=0;v=vector(y);v[1]=x;for(i=2,#v,for(a=1,i-1,if(sigma(v[i-1])-v[i-1]==0 || sigma(v[i-1])-v[i-1]==v[a],break(2),b=b+1;if(b==i-1,v[i]=sigma(v[i-1])-v[i-1];b=0;break()))))
this works better for now.
science_man_88 is offline   Reply With Quote
Old 2011-01-03, 20:56   #2107
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Code:
aliquot(x,y)=b=0;v=vector(y);v[1]=x;for(i=2,#v,for(a=1,i-1,if(sigma(v[i-1])-v[i-1]==0 || sigma(v[i-1])-v[i-1]==v[a],v=vector(i-1,n,v[n]);break(2),b=b+1;if(b==i-1,v[i]=sigma(v[i-1])-v[i-1];b=0;break()))))
this not only works but trims off excess.
science_man_88 is offline   Reply With Quote
Old 2011-01-04, 15:14   #2108
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
kar_bon, I understand what an aliquot sequence is, but that doesn't tell me what sm88 wants.

I take it from his last post that he wants a vector with last term 1 and first term the input, where v[i+1] = sigma(v[i]) - v[i]. But of course it's not even proven that such a vector exists for all n...!
I see one possible exception but I don't know how to calculate when it would happen, a sequence with all abundant numbers as it would forever increase.
science_man_88 is offline   Reply With Quote
Old 2011-01-04, 19:34   #2109
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
I see one possible exception but I don't know how to calculate when it would happen, a sequence with all abundant numbers as it would forever increase.
good news I've been testing x upto 3 million until the 4th spot in the sequence each and no x so far has made it past 3 terms that are abundant. the problem is if it decreases to another abundant number spiking it back up. Doh calculation error. redone and still accurate.

Last fiddled with by science_man_88 on 2011-01-04 at 19:44
science_man_88 is offline   Reply With Quote
Old 2011-01-04, 20:35   #2110
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

done up to 7 million now without a trace of a triply ? abundant number.
science_man_88 is offline   Reply With Quote
Old 2011-01-29, 19:08   #2111
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

I couldn't get the addhelp to add help I've had it working before but I just tried the autosave that lavalamp got me doing and I can't get what I want to work.
science_man_88 is offline   Reply With Quote
Old 2011-01-29, 19:48   #2112
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Code:
(15:45)>for(x=1,400,if(((2^x)/(log(2^x)-1))-((2^x-1)/(log(2^x-1)-1))>=1,print(x)))
108
116
this is my attempt at something new if only I could get it to align with A000043.
science_man_88 is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

All times are UTC. The time now is 15:31.


Fri Aug 6 15:31:42 UTC 2021 up 14 days, 10 hrs, 1 user, load averages: 2.41, 2.73, 2.83

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.