mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

science_man_88 2010-12-22 14:49

[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())))[/CODE]

Basically checking for [url]http://oeis.org/A135980[/url] , 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.

science_man_88 2010-12-22 14:58

[QUOTE=science_man_88;243003][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())))[/CODE]

Basically checking for [url]http://oeis.org/A135980[/url] , 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.[/QUOTE]

note putting a i=i-1 in the if false part worked.

science_man_88 2011-01-03 16:29

[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()))))[/CODE]

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 2011-01-03 20:15

[QUOTE=science_man_88;244430][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()))))[/CODE]

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.[/QUOTE]

crap a failure.

[CODE]for(x=1,100, print(aliquot(x,5)))[/CODE]

gave 95,25,6,6,6, but it should have terminated after finding the second 6.

science_man_88 2011-01-03 20:50

[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()))))[/CODE] this works better for now.

science_man_88 2011-01-03 20:56

[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()))))[/CODE] this not only works but trims off excess.

science_man_88 2011-01-04 15:14

[QUOTE=CRGreathouse;229472]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...![/QUOTE]

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 2011-01-04 19:34

[QUOTE=science_man_88;244558]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.[/QUOTE]

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.

science_man_88 2011-01-04 20:35

done up to 7 million now without a trace of a triply ? abundant number.

science_man_88 2011-01-29 19:08

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 2011-01-29 19:48

[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[/CODE] this is my attempt at something new if only I could get it to align with A000043.


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

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