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-09-08 18:00

[CODE]substring(string_to_search,string_to_find)=my(s1=Vec(string_to_search),s2=Vec(string_to_find),good);c="";for(i=0,#s1-#s2,good=1;for(j=1,#s2,if(s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,return(concat(c,"loser!"))));0;[/CODE]

this should be accurate CRG if you put:

substring("Shut up 3.14159","3.14159")

you should get a return of "Shut up loser!" :lol: something tells me someone will care lol.

CRGreathouse 2010-09-08 19:03

(Be nice!)

So your function (which should be called something like "replace") looks for the second string in the first. If it finds it, the function removes the found part and everything after it, replacing it and everything following with the fixed string "loser!" in this case (probably a third argument in a polished version). If the second string isn't found, it returns 0.

science_man_88 2010-09-08 19:09

[QUOTE=CRGreathouse;229067](Be nice!)

So your function (which should be called something like "replace") looks for the second string in the first. If it finds it, the function removes the found part and everything after it, replacing it and everything following with the fixed string "loser!" in this case (probably a third argument in a polished version). If the second string isn't found, it returns 0.[/QUOTE]

or an error in the polished version to tell them none of this subgroup of the descriptions were found technically I want the final phrasing returned including the part after replacing then we can use substring to check for other substrings. in a for loop we could all a Vec of Vec that tell which Vec to check the descriptions in. yeah i know complicated lol.

science_man_88 2010-09-08 19:56

put this :

[CODE];for(x=i,#s1-1,d=concat(d,s1[x+1]));[/CODE]

before the return and i think that's what I can do so far (still want it to check the rest of the string if i can do a simple replacement part I have a way with vector concatenation I think ,concat the index it finds it at into an array then use that array to do the replacements)


Edit: declare it first near where c is declared if you go this way.

science_man_88 2010-09-08 20:18

I think there's an easier way:

1)find s2 in s1 record all until you found s1 in c (like I already have working)
2)have a replacement Vec of Vec with a value to replace S2 with
3)concat c and the replacement value onto a new variable.
4)clear C out;
5)Repeat 1..4 as needed until end of search for that string
6)change to a new Vec of Vec.
7)Repeat 1..6 until every search is done.
8)print out the result ? (maybe start finding a script to interpret what it's figured out.)

science_man_88 2010-09-08 21:36

[CODE]%113 = (string_to_search,string_to_find)->my(s1=Vec(string_to_search),s2=Vec(string_to_find),good);c="";d="";for(i=0,#s1-#s2,good=1;for(j=1,#s2,if(s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,d=concat(d,(concat(c,"loser!")))));return(d)
(18:32) gp > substring("hello Alex, Good bye Alex","Alex") ))));return(d)
%114 = "hello loser!hello lex, Good bye loser!"[/CODE]

best I can do for now maybe if i turn my steps to code I'll have more luck lol.

science_man_88 2010-09-08 21:53

one more thing worked out and I think I have it for one find replace then it's a matter of vectors i think.

science_man_88 2010-09-08 21:55

[CODE]%135 = (string_to_search,string_to_find)->my(s1=Vec(string_to_search),s2=Vec(string_to_find),good);c="";d="";for(i=0,#s1-#s2,good=1;for(j=1,#s2,if(s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,d=concat(c,"loser!");print1(d);c="";i=i+#s2))
(18:51) gp > substring("hello Alex, Good bye Alex","Alex") c="";i=i+#s2))
hello loser! Good bye loser!
<s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,d=concat(c,"loser!");print1(d);c="";i=i+#s2))[/CODE]

Ive got to pass it to a full vector now and then get it resubmitting it until all the searches are done lol.

science_man_88 2010-09-08 22:12

which could be done with a further script part to multi-search with Vec()

CRGreathouse 2010-09-08 22:29

It looks like you have it working the way you want.

science_man_88 2010-09-08 22:52

[QUOTE=CRGreathouse;229100]It looks like you have it working the way you want.[/QUOTE]

well I think one more change may help. then you can apply it to Vec of Vec to do find and replace and maybe even a Vec of Vec to call each Vec of Vec to search multiple functions to make it search for ? or do you want me to set up Vec although you want to Use it on your PC it may need them to do multiple searches autonomously.

science_man_88 2010-09-08 23:01

[CODE]%4 = (string_to_search,string_to_find,string_to_replace_with)->my(s1=Vec(string_to_search),s2=Vec(string_to_find),s3=string_to_replace_with,good);c="";d="";for(i=0,#s1-#s2,good=1;for(j=1,#s2,if(s2[j]!=s1[j+i],good=0;c=concat(c,s1[i+1]);break));if(good,d=concat(c,s3);print1(d);c="";i=i+#s2))
(19:58) gp > FaR("Hello Alex","Alex","loser!") c="";i=i+#s2))
Hello loser!
(19:58) gp >[/CODE]

FaR = [B]F[/B]ind [B]a[/B]nd [B]R[/B]eplace

science_man_88 2010-09-08 23:11

[CODE](19:58) gp > primorial=["primorial","prime factorial"]
%5 = ["primorial", "prime factorial"]
(20:06) gp > for(x=2,#primorial,FaR("I want the prime factorial",primorial[x],primorial[1])
*** syntax error, unexpected $end, expecting KPARROW or ',' or ')': ...primorial[x],primorial[1])
^-
(20:08) gp > for(x=2,#primorial,FaR("I want the prime factorial",primorial[x],primorial[1]))
I want the primorial[/CODE]

showing a way to extend it I made a primorial Vec, I then can say from 2 to # primorial, call FaR and check for them if they are there replace with the first in the Vec.

science_man_88 2010-09-08 23:22

Give me Vec with technical names and non technical descriptions and maybe I can try for multiple Vec to check through using a matrix etc.

science_man_88 2010-09-08 23:53

10 Aug 10, 08:52 PM is my first post on a scriptwriter (page 7) so under a month and with arguments we've figured it out lol.

mostly*

CRGreathouse 2010-09-09 04:28

[QUOTE=science_man_88;229105]Give me Vec with technical names and non technical descriptions and maybe I can try for multiple Vec to check through using a matrix etc.[/QUOTE]

For what it's worth, here are some recent-ish posts I've made where I've converted a description to Pari code:

[url]http://mymathforum.com/viewtopic.php?f=40&t=14769i[/url]
[code]trinv(n)=(sqrtint(8*n-7)+1)>>1
forprime(p=2,1e9,if(is(p,trinv(p)),print("S_0 = "p", c = "trinv(p))))[/code]

[url]http://mymathforum.com/viewtopic.php?f=40&t=15163&start=15[/url]
[code]Cohn(P,a='x)={
my(d=poldegree(P,a),an=polcoeff(P,d,a),b=0);
for(i=0,d-1,b=max(b,abs(polcoeff(P,i,a))));
b=ceil(b/an)+1;
while(1,
if(isprime(substpol(P,a,b++)),return(b))
)
};
addhelp(Cohn, "Cohn(P): If P is an irreducible polynomial, return a proof certificate p; otherwise, infinite loop. Based on Ram Murty 2002.");[/code]

[url]http://mymathforum.com/viewtopic.php?f=44&t=14683[/url]
[code]for(n=6000,0,if(isprime(n) && 6000%n==0, print(n)))
forstep(n=6000,0,-1,if(isprime(n) && 6000%n==0, print(n)))
for(n=0,6000,if(isprime(n) && 6000%n==0, print(n)))
forprime(p=0,6000,if(6000%p==0, print(p)))
fordiv(6000,n,if(isprime(n), print(n)))
f=factor(6000)[,1]; for(i=1,#f,print(f[i]))[/code]

[url]http://mymathforum.com/viewtopic.php?f=24&t=14446[/url]
[code]step(M)=my(m,MM=matrix(4,4));for(i=1,4,for(j=1,4,m=M[i,j];if(i==4|j==4,MM[i,j]+=m*1087,if(i==3&j==3,MM[i,j]+=425*m,MM[i+1,j+1]+=425*m);MM[i+1,j]+=187*m;MM[i,j+1]+=475*m)));MM
matrix(4,4,x,y,x==1&y==1)
step(%)[/code]

[url]http://mymathforum.com/viewtopic.php?f=40&t=13249[/url]
[code]er(n)=my(s=eval(Vec(Str(8*n))),n=0);for(i=1,#s,if(s[i]&s[i]!=8,n=10*n+s[i]));n
err1(n,verbose=0)=my(nn,orig=n);while(nn!=n,nn=n;if(n=er(n)<orig,return()))
for(n=1,1e8,err1(n))[/code]

[url]http://mymathforum.com/viewtopic.php?f=40&t=12565[/url]
[code]factorPueo(P = 2009)={
my(m=1, k=(sqrtint(1+8*P)-1)>>1, NB=k*(k+1)/2, NA=NB+m+k, i);
\\ m = 1 is a triangle number; solve k*(k1)/2 = P for k
\\ define two numbers, NB = S(m,k) and NA = S(m,k+1), that bracket P

while(NB!=P,
while(NB > P, \\ is NB too large?
NA = NB;
NB -= m + k - 1;
k -= 1
);
while(NA <= P, \\ is NA too small?
NB = NA;
NA += m + k + 1;
k += 1
);
if(NB < P,
NB += k; \\ make NB larger using [6] above to increase m
NA += k + 1; \\ make NA larger using [7] above to increase m
m += 1
)
);

i = k;
if(i%2 == 0, \\ if k is even, divide by 2 to get factor of P
i /= 2
);

j = P/i;
print("S("m","k") = "P);
print(i" * "j" = "i*j);
};[/code]

The difficulties of these underscores the scope of your project...

science_man_88 2010-09-09 11:39

you're over worked and underpaid.

I've got the basics of math English down with this code though I'll make more list.

if you look at it correcting typo is a task it would need to be AI complete.

the more tasks we need it to do and the more Vec we need to do this the more memory intensive it would be.

CRGreathouse 2010-09-09 12:59

[QUOTE=science_man_88;229151]I've got the basics of math English down with this code though I'll make more list.[/QUOTE]

Good idea. I'm not sure my list is useful here -- these are complicated and hard-to-generalize examples. :redface:

[QUOTE=science_man_88;229151]if you look at it correcting typo is a task it would need to be AI complete.[/QUOTE]

I hope not... that looks doable in most cases to me, with some form of spell-check plus a trigram (?) prediction algorithm run across large bodies of text. Not an easy task, though!

science_man_88 2010-09-09 18:32

[QUOTE=CRGreathouse;229155]Good idea. I'm not sure my list is useful here -- these are complicated and hard-to-generalize examples. :redface:



I hope not... that looks doable in most cases to me, with some form of spell-check plus a trigram (?) prediction algorithm run across large bodies of text. Not an easy task, though![/QUOTE]

I've been playing cards most of the day and thinking about this I think I could manage it and cut the memory cost down by using a form of FaR for spell check.

then find and replace (possibly with find and replace on the Vec to capture multiple forms of the same thing (not quite sure how to do this though)).

saves on building new scripts as well if we could do it this way.

science_man_88 2010-09-09 18:41

in fact FaR could be used in:

1) encoding and decoding shi*t(* is wild card but can be f or no character in this case) ciphers

2)Find and Replace

3)Find and replace of spelling errors.

and many other ways I suspect.

CRGreathouse 2010-09-09 20:10

[QUOTE=science_man_88;229193]in fact FaR could be used in:

1) encoding and decoding shi*t(* is wild card but can be f or no character in this case) ciphers

2)Find and Replace

3)Find and replace of spelling errors.

and many other ways I suspect.[/QUOTE]

Yes, it's quite a general function. More general yet (but harder!) would be a regular expression engine.

science_man_88 2010-09-09 20:27

[QUOTE=CRGreathouse;229204]Yes, it's quite a general function. More general yet (but harder!) would be a regular expression engine.[/QUOTE]

2 and 3 are things we'd likely want in the polished version.

spell check then pass to a math based FaR .

we could put it in a file to spell check with a already built spell checker program (though this sounds harder than another FaR based script) then read it into FaR
also I think I need one more thing in FaR as if I realized correct it only works fully when your phrase ends with what you're searching for.

science_man_88 2010-09-09 20:29

[QUOTE=CRGreathouse;229204]Yes, it's quite a general function. More general yet (but harder!) would be a regular expression engine.[/QUOTE]

yeah the hard part from my script I see is the original things to look for.

science_man_88 2010-09-09 21:44

[QUOTE=CRGreathouse;229155]trigram (?)[/QUOTE]

[url]http://en.wikipedia.org/wiki/Trigram[/url]

CRGreathouse 2010-09-09 23:34

[QUOTE=science_man_88;229206]spell check then pass to a math based FaR .

we could put it in a file to spell check with a already built spell checker program (though this sounds harder than another FaR based script) then read it into FaR
also I think I need one more thing in FaR as if I realized correct it only works fully when your phrase ends with what you're searching for.[/QUOTE]

If you build a spell checker (whether based on your FaR script or not) that would be pretty cool -- maybe even science fair-worthy, if you're at a level that does that sort of thing.

CRGreathouse 2010-09-09 23:35

[QUOTE=science_man_88;229217][url]http://en.wikipedia.org/wiki/Trigram[/url][/QUOTE]

Yes, I was talking about what that page calls word-level trigrams. See
[url]https://secure.wikimedia.org/wikipedia/en/wiki/N-gram#n-gram_models[/url]

science_man_88 2010-09-09 23:56

now this is sounding complex lol.

CRGreathouse 2010-09-09 23:59

[QUOTE=science_man_88;229229]now this is sounding complex lol.[/QUOTE]

Yes, it *is* rather complex. But it's easier than the final project, and should be good practice. Also, you [i]could do it[/i] -- not that it would be easy, but with how far you've come I have no doubt.

science_man_88 2010-09-10 00:56

[QUOTE=CRGreathouse;229231]Yes, it *is* rather complex. But it's easier than the final project, and should be good practice. Also, you [i]could do it[/i] -- not that it would be easy, but with how far you've come I have no doubt.[/QUOTE]


I like how this can be used in DNA stuff I may use that part again lol

FaR was a change in mindset I saw this mentally:

[CENTER]Replacement
[TEX]\down[/TEX]
Start + Word_to Change + Finish
[TEX]\down[/TEX][/CENTER]


but really my code now does:


[CENTER]Repeat(up_to_Change + Replacement[TEX]\right[/TEX]Variable[TEX]\right[/TEX]print(variable))
print(up_to_change)[/CENTER]

science_man_88 2010-09-10 14:25

[QUOTE=CRGreathouse;229231]Yes, it *is* rather complex. But it's easier than the final project, and should be good practice. Also, you [i]could do it[/i] -- not that it would be easy, but with how far you've come I have no doubt.[/QUOTE]

I guessing looking for x spaces and reading it into c would help in one sense then knock off the first word and replace it with the next one.

science_man_88 2010-09-10 18:52

is there a way to shift Vec of Vec like vectors ? if so that may come in handy.

CRGreathouse 2010-09-10 19:53

[QUOTE=science_man_88;229322]is there a way to shift Vec of Vec like vectors ? if so that may come in handy.[/QUOTE]

You can make a vector of vectors, if you like... is that what you're asking?

science_man_88 2010-09-10 20:38

[QUOTE=CRGreathouse;229330]You can make a vector of vectors, if you like... is that what you're asking?[/QUOTE]

I know you can make Vec(Vec(),Vec())... but can you alter them by shifting like vectors can do ?

CRGreathouse 2010-09-10 21:49

Can you give an example?

science_man_88 2010-09-10 22:07

for example for a vector v you can use:

[CODE]v=vector(100,n,n);v=vector(#v-1,n,v[n+1])[/CODE]

to shift it by one.

is there an equivalent to this for Vec ?

CRGreathouse 2010-09-10 23:50

[QUOTE=science_man_88;229357]for example for a vector v you can use:

[CODE]v=vector(100,n,n);v=vector(#v-1,n,v[n+1])[/CODE]

to shift it by one.

is there an equivalent to this for Vec ?[/QUOTE]

??

It would be exactly the same.

science_man_88 2010-09-10 23:56

[QUOTE=CRGreathouse;229368]??

It would be exactly the same.[/QUOTE]

how'd you set up that Vec of Vec again ? I swear i saw you do it but I don't get it to work when i try it lol.

CRGreathouse 2010-09-11 04:39

Example 1:
[[1,2,3,4,5],[2,3,5,7,11]]

Example 2:
vector(5,n,vector(10,m,m^n))

science_man_88 2010-09-11 12:46

how will this help with Vec ?

CRGreathouse 2010-09-11 13:13

I just don't understand what you're saying. Let's start from the top. Without using any Pari terminology, what are you trying to accomplish?

science_man_88 2010-09-11 13:49

1)read strings into an array
2)find a meaning if possible.
3)once the array is of n length move every string forward one in the array,
4)add a new word in the last index of the array

CRGreathouse 2010-09-11 18:20

[QUOTE=science_man_88;229402]1)read strings into an array[/QUOTE]

You probably should take a string as an argument, rather than reading from the keyboard.

[QUOTE=science_man_88;229402]2)find a meaning if possible.[/QUOTE]

That's the hard part, of course.

[QUOTE=science_man_88;229402]3)once the array is of n length move every string forward one in the array,[/QUOTE]

You can do this
[code]shiftforward(v)=vector(#v+1,i,if(i==1,"initial value", v[i-1]))[/code]

but you'd probably be better off using a function that only looks at one string at a time (which can be called by a function that takes a vector of strings).

science_man_88 2010-09-11 20:40

[QUOTE=CRGreathouse;229417]You probably should take a string as an argument, rather than reading from the keyboard.



That's the hard part, of course.



You can do this
[code]shiftforward(v)=vector(#v+1,i,if(i==1,"initial value", v[i-1]))[/code]

but you'd probably be better off using a function that only looks at one string at a time (which can be called by a function that takes a vector of strings).[/QUOTE]

I don't even remember your lessons of Vec of Vec or what ever it was to make the array.

yeah this part is mis-ordered but it's one we'll have to cover

the hard part is make the array I think I have away I'll try it.
yeah I was thinking of using FaR for one part and replacing with another word.

CRGreathouse 2010-09-11 22:01

[QUOTE=science_man_88;229425]I don't even remember your lessons of Vec of Vec or what ever it was to make the array.[/QUOTE]

I don't know what you want in the array. Here are general ways to make arrays/vectors:

Method 1, "Initialization":
v=vector(size_of_vector, i, vector_value_at(i))

Method 2, "Set in a Loop":
v=vector(size_of_vector);
for(i=1,#v,v[i]=vector_value_at(i))

Method 3, "Size Not Known Ahead of Time"
v=[];
for(x=start_x,stop_x,if(stuff_involving(x), v=concat(v, vector_value_at_x(x))))

science_man_88 2010-09-11 22:03

I want an array of each word in sequence. into an array then i can check the array for groupings of words I think to denote what it means.

science_man_88 2010-09-11 22:45

I couldn't get any ecm / aliquot stuff to work for me so I built my own code unfortunately it only looks to work for perfect numbers.

[CODE]Aliquot(n)= v=vector(1,x,n);for(a=2,10,d=sumdiv(v[a-1],X,X=X)-v[a-1];v=concat(v,d))[/CODE]

I have no clue why this doesn't work, except a factorint error.

CRGreathouse 2010-09-12 05:41

What is it trying to do?

science_man_88 2010-09-12 11:05

[QUOTE=CRGreathouse;229450]What is it trying to do?[/QUOTE]

[CODE]Aliquot(n)[/CODE]

CRGreathouse 2010-09-12 14:40

Return a vector of the aliquot parts? Return the sum of the aliquot parts? Loop over the aliquot parts? Something else?

science_man_88 2010-09-12 15:00

[QUOTE=CRGreathouse;229461]Return a vector of the aliquot parts? Return the sum of the aliquot parts? Loop over the aliquot parts? Something else?[/QUOTE]

return aliquot sequence n

CRGreathouse 2010-09-12 15:01

[QUOTE=science_man_88;229463]return aliquot sequence n[/QUOTE]

Give me an example.

science_man_88 2010-09-12 15:06

[8,7,1] ?

kar_bon 2010-09-12 16:36

[QUOTE=CRGreathouse;229465]Give me an example.[/QUOTE]

[url=http://en.wikipedia.org/wiki/Aliquot_sequence]Aliquot Sequence[/url]:

[tex]\sigma[/tex](N) -> Sum of proper divisors of N (Sigma(N)).

Example sequence:
s[sub]0[/sub]= N
s[sub]1[/sub] = [tex]\sigma[/tex][sub]n-1[/sub] - s[sub]n-1[/sub]

So for N=10 you get:
10 = 10+ 5 + 2 + 1 = 18 -> 18-10 = 8
8 = 8 + 4 + 2 + 1 = 15 -> 15-8 = 7
7 = 7 + 1 = 8 -> 8-7 = 1 STOP

Ses also the thread [url=http://www.mersenneforum.org/forumdisplay.php?f=90]here[/url] and the first open sequence (without ending found yet) [url=http://factordb.com/search.php?se=1&aq=276&action=last20&fr=&to=]here[/url]
and my summary pages (Menu Aliquot Seqs.) [url=www.rieselprime.de]here[/url] (not yet fully updated).

CRGreathouse 2010-09-12 16:47

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...!

science_man_88 2010-09-12 16:48

basically I wanted to try and find all of the aliquot sequences but I made code that no matter what and I may have an earlier code than this but no matter what I get an error for all but perfect numbers.

science_man_88 2010-09-12 16:52

[CODE]%68 = (n)->v=vector(1,x,n);for(a=2,10,d=sumdiv(v[a-1],X,X=X)-v[a=1];v=concat(v,d))
(13:51) gp > Aliquot(4)
*** user interrupt after 27,032 ms.
*** bug in PARI/GP (Segmentation Fault), please report[/CODE]

looks like something else gone wrong now.

CRGreathouse 2010-09-12 17:17

It may be worth pointing out that the aliquot function is calculated in Pari as
sigma(n)-n
and so essentially all of your program will be doing 'the rest', whatever that is.

science_man_88 2010-09-12 17:23

[QUOTE=CRGreathouse;229477]It may be worth pointing out that the aliquot function is calculated in Pari as
sigma(n)-n
and so essentially all of your program will be doing 'the rest', whatever that is.[/QUOTE]

put the next one in the sequence etc.

science_man_88 2010-09-12 18:00

got it working now but I get a error of:

[CODE]*** sigma: couldn't find a suitable name for a tempdir (MPQS).[/CODE]

the codes are:

[CODE]Alistep(n)=sigma(n)-n[/CODE]

And :

[CODE]Aliquot(n)= v=vector(1,x,n);for(a=2,1000,d=Alistep(v[a-1]);v=concat(v,d);if(d==n || d==1,break()));print(v)[/CODE]

And I tried :

[CODE]for(n=2,1000,Aliquot(n))[/CODE]

science_man_88 2010-09-12 19:23

I'm an idiot the error I was getting was because 276 never ends i think lol or at least in my memory.

CRGreathouse 2010-09-13 00:10

[QUOTE=science_man_88;229491]I'm an idiot the error I was getting was because 276 never ends i think lol or at least in my memory.[/QUOTE]

You could have it print at every step to see what's going on. Also, you could durn up the debug setting and watch the details of the factorization:
default(debug,4)

science_man_88 2010-09-13 11:48

[CODE]IFAC: cracking composite
49837306273
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 36-bit integer
Rho: using X^2-5 for up to 14 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 223241, -190548) and (1, 499185, -216785)
of discriminants
49837306273 and 249186531365, respectively
SQUFOF: square form (287^2, 366943, -347641) on second cycle
after 260 iterations, time = 0 ms
SQUFOF: found factor 1 from ambiguous form
after 115 steps on the ambiguous cycle, time = 0 ms
SQUFOF: square form (288^2, 62545, -138423) on first cycle
after 430 iterations, time = 0 ms
SQUFOF: found factor 97379 from ambiguous form
after 214 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 511787
IFAC: factor 511787
is prime
IFAC: factor 97379
is prime
IFAC: prime 97379
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 511787
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
49838524607
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 36-bit integer
Rho: using X^2-5 for up to 14 rounds of 32 iterations
Rho: time = 0 ms, 13 rounds
found factor = 42727
IFAC: cofactor = 1166441
IFAC: factor 1166441
is prime
IFAC: factor 42727
is prime
IFAC: prime 42727
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 1166441
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
2721817661
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 32-bit integer
Rho: using X^2+1 for up to 14 rounds of 32 iterations
Rho: time = 0 ms, 10 rounds
found factor = 83653
IFAC: cofactor = 32537
IFAC: factor 83653
is prime
IFAC: factor 32537
is prime
IFAC: prime 32537
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 83653
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
54334848889
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 36-bit integer
Rho: using X^2-5 for up to 14 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 233097, -159370) and (1, 521223, -207179)
of discriminants
54334848889 and 271674244445, respectively
SQUFOF: square form (427^2, 506629, -20569) on second cycle
after 32 iterations, time = 0 ms
SQUFOF: found factor 126233 from ambiguous form
after 19 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 430433
IFAC: factor 430433
is prime
IFAC: factor 126233
is prime
IFAC: prime 126233
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 430433
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
365960156741
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 39-bit integer
Rho: using X^2-11 for up to 14 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 604945, -425929) and (1, 1352701, -197076)
of discriminants
365960156741 and 1829800783705, respectively
SQUFOF: square form (317^2, 443633, -420817) on first cycle
after 250 iterations, time = 0 ms
SQUFOF: found factor 472909 from ambiguous form
after 138 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 773849
IFAC: factor 773849
is prime
IFAC: factor 472909
is prime
IFAC: prime 472909
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 773849
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
10960414475993
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 44-bit integer
Rho: using X^2-5 for up to 18 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 3310651, -1108048) and (1, 7402841, -4377171)
of discriminants
10960414475993 and 54802072379965, respectively
SQUFOF: square form (1867^2, 1089215, -3845415) on second cycle
after 4858 iterations, time = 0 ms
SQUFOF: found factor 1 from ambiguous form
after 2488 steps on the ambiguous cycle, time = 0 ms
SQUFOF: square form (536^2, 2917221, -2132153) on first cycle
after 4946 iterations, time = 0 ms
SQUFOF: ...but the root form seems to be on the principal cycle
SQUFOF: square form (1551^2, 5632927, -2397759) on second cycle
after 5224 iterations, time = 0 ms
SQUFOF: found factor 545161 from ambiguous form
after 2620 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 20104913
IFAC: factor 20104913
is prime
IFAC: factor 545161
is prime
IFAC: prime 545161
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 20104913
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
130880593285187
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 47-bit integer
Rho: using X^2-11 for up to 24 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 19815189, -16187460) and (1, 22880610, -14792162)
of discriminants
392641779855561 and 523522373140748, respectively
SQUFOF: square form (77^2, 22879994, -1191082) on second cycle
after 696 iterations, time = 0 ms
SQUFOF: found factor 3658709 from ambiguous form
after 347 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 35772343
IFAC: factor 35772343
is prime
IFAC: factor 3658709
is prime
IFAC: prime 3658709
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 35772343
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
109656764446793
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 47-bit integer
Rho: using X^2-11 for up to 24 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 10471711, -8294818) and (1, 23415461, -2097861)
of discriminants
109656764446793 and 548283822233965, respectively
SQUFOF: square form (3379^2, 20729739, -2596021) on second cycle
after 586 iterations, time = 0 ms
SQUFOF: found factor 4170377 from ambiguous form
after 288 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 26294209
IFAC: factor 26294209
is prime
IFAC: factor 4170377
is prime
IFAC: prime 4170377
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 26294209
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
16448057399
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 34-bit integer[/CODE]

science_man_88 2010-09-13 11:49

[CODE]Rho: using X^2+3 for up to 14 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 222135, -53493) and (1, 256498, -251398)
of discriminants
49344172197 and 65792229596, respectively
SQUFOF: square form (379^2, 169694, -64390) on second cycle
after 162 iterations, time = 0 ms
SQUFOF: ...found nothing on the ambiguous cycle
after 87 steps there, time = 0 ms
SQUFOF: square form (323^2, 53383, -111413) on first cycle
after 530 iterations, time = 0 ms
SQUFOF: found factor 53699 from ambiguous form
after 264 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 306301
IFAC: factor 306301
is prime
IFAC: factor 53699
is prime
IFAC: prime 53699
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 306301
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
58889746791332141
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 56-bit integer
Rho: using X^2+1 for up to 42 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 242672097, -32238683) and (1, 542631305, -197664420)
of discriminants
58889746791332141 and 294448733956660705, respectively
SQUFOF: square form (3473^2, 225112409, -170252335) on first cycle
after 6416 iterations, time = 0 ms
SQUFOF: ...but the root form seems to be on the principal cycle
SQUFOF: square form (3295^2, 228742171, -151210069) on first cycle
after 11836 iterations, time = 0 ms
SQUFOF: found factor 15199501 from ambiguous form
after 5936 steps on the ambiguous cycle, time = 16 ms
IFAC: cofactor = 3874452641
IFAC: factor 3874452641
is prime
IFAC: factor 15199501
is prime
IFAC: prime 15199501
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 3874452641
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
700068390570323
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 50-bit integer
Rho: using X^2+3 for up to 30 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 45827995, -11497736) and (1, 52917610, -28542298)
of discriminants
2100205171710969 and 2800273562281292, respectively
SQUFOF: square form (704^2, 45110965, -32891396) on first cycle
after 3560 iterations, time = 0 ms
SQUFOF: found factor 108413 from ambiguous form
after 1776 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 6457421071
IFAC: factor 6457421071
is prime
IFAC: factor 108413
is prime
IFAC: prime 108413
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 6457421071
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
70308163563190573
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 56-bit integer
Rho: using X^2+1 for up to 42 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 265156865, -126640587) and (1, 592908775, -585988060)
of discriminants
70308163563190573 and 351540817815952865, respectively
SQUFOF: square form (9659^2, 434027253, -437212394) on second cycle
after 2400 iterations, time = 0 ms
SQUFOF: found factor 190541251 from ambiguous form
after 1174 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 368991823
IFAC: factor 368991823
is prime
IFAC: factor 190541251
is prime
IFAC: prime 190541251
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 368991823
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
3914706400999321
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 52-bit integer
Rho: using X^2-5 for up to 34 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 62567613, -51120388) and (1, 139905439, -35803471)
of discriminants
3914706400999321 and 19573532004996605, respectively
SQUFOF: square form (2044^2, 62432613, -1009783) on first cycle
after 1174 iterations, time = 0 ms
SQUFOF: ...but the root form seems to be on the principal cycle
SQUFOF: square form (6380^2, 18890661, -21851749) on first cycle
after 1990 iterations, time = 0 ms
SQUFOF: found factor 1430381 from ambiguous form
after 1036 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 2736827741
IFAC: factor 2736827741
is prime
IFAC: factor 1430381
is prime
IFAC: prime 1430381
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 2736827741
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
2131191994788359
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 51-bit integer
Rho: using X^2+5 for up to 32 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 79959839, -32864789) and (1, 92329670, -4211134)
of discriminants
6393575984365077 and 8524767979153436, respectively
SQUFOF: square form (3979^2, 79020915, -2357043) on first cycle
after 120 iterations, time = 0 ms
SQUFOF: found factor 244901 from ambiguous form
after 63 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 8702259259
IFAC: factor 8702259259
is prime
IFAC: factor 244901
is prime
IFAC: prime 244901
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 8702259259
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
1102454807185913029
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 60-bit integer
Rho: using X^2-5 for up to 50 rounds of 32 iterations
Rho: time = 0 ms, 21 rounds
found factor = 6909547
IFAC: cofactor = 159555294607
IFAC: factor 159555294607
is prime
IFAC: factor 6909547
is prime
IFAC: prime 6909547
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 159555294607
appears with exponent = 1
IFAC: main loop: this was the last factor[/CODE]

science_man_88 2010-09-13 11:50

[CODE]IFAC: cracking composite
11365516766085787
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 54-bit integer
Rho: using X^2+11 for up to 38 rounds of 32 iterations
Rho: time = 0 ms, 13 rounds
found factor = 64013
IFAC: cofactor = 177550134599
IFAC: factor 177550134599
is prime
IFAC: factor 64013
is prime
IFAC: prime 64013
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 177550134599
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
82908375352597
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 47-bit integer
Rho: using X^2-11 for up to 24 rounds of 32 iterations
Rho: time = 0 ms, 23 rounds
found factor = 1714963
IFAC: cofactor = 48344119
IFAC: factor 48344119
is prime
IFAC: factor 1714963
is prime
IFAC: prime 1714963
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 48344119
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
394510727366999
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 49-bit integer
Rho: using X^2-1 for up to 28 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 34402501, -26761499) and (1, 39724588, -4424563)
of discriminants
1183532182100997 and 1578042909467996, respectively
SQUFOF: square form (3269^2, 27439539, -10073679) on first cycle
after 1938 iterations, time = 0 ms
SQUFOF: ...but the root form seems to be on the principal cycle
SQUFOF: square form (3701^2, 11516255, -19180793) on first cycle
after 4882 iterations, time = 0 ms
SQUFOF: found factor 7312127 from ambiguous form
after 2338 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 53952937
IFAC: factor 53952937
is prime
IFAC: factor 7312127
is prime
IFAC: prime 7312127
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 53952937
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
706653000869
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 40-bit integer
Rho: using X^2+1 for up to 14 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 840625, -652561) and (1, 1879697, -1048134)
of discriminants
706653000869 and 3533265004345, respectively
SQUFOF: square form (383^2, 603429, -583763) on first cycle
after 1344 iterations, time = 0 ms
SQUFOF: ...but the root form seems to be on the principal cycle
SQUFOF: square form (467^2, 530905, -486949) on first cycle
after 1386 iterations, time = 0 ms
SQUFOF: found factor 89839 from ambiguous form
after 698 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 7865771
IFAC: factor 7865771
is prime
IFAC: factor 89839
is prime
IFAC: prime 89839
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 7865771
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
1451496582990409
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 51-bit integer
Rho: using X^2+5 for up to 32 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 38098511, -10643322) and (1, 85190861, -29257681)
of discriminants
1451496582990409 and 7257482914952045, respectively
SQUFOF: square form (2201^2, 82074871, -26896951) on second cycle
after 3370 iterations, time = 0 ms
SQUFOF: ...but the root form seems to be on the principal cycle
SQUFOF: square form (2883^2, 36763657, -3005710) on first cycle
after 6178 iterations, time = 0 ms
SQUFOF: found factor 2844229 from ambiguous form
after 3132 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 510330421
IFAC: factor 510330421
is prime
IFAC: factor 2844229
is prime
IFAC: prime 2844229
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 510330421
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
6810873395278529
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 53-bit integer
Rho: using X^2+7 for up to 36 rounds of 32 iterations
Rho: time = 0 ms, 22 rounds
found factor = 403327
IFAC: cofactor = 16886728127
IFAC: factor 16886728127
is prime
IFAC: factor 403327
is prime
IFAC: prime 403327
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 16886728127
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
415464790198968637
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 59-bit integer
Rho: using X^2+5 for up to 48 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 644565581, -497275269) and (1, 1441292457, -1097436584)
of discriminants
415464790198968637 and 2077323950994843185, respectively
SQUFOF: square form (25742^2, 1380396991, -64826059) on second cycle
after 132 iterations, time = 0 ms
SQUFOF: found factor 1488499 from ambiguous form
after 53 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 279116606863
IFAC: factor 279116606863
is prime
IFAC: factor 1488499
is prime
IFAC: prime 1488499
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 279116606863
appears with exponent = 1
IFAC: main loop: this was the last factor
IFAC: cracking composite
29355379363049741
IFAC: checking for pure square
IFAC: checking for odd power
IFAC: trying Pollard-Brent rho method
Rho: searching small factor of 55-bit integer
Rho: using X^2-11 for up to 40 rounds of 32 iterations
Rho: time = 0 ms, Pollard-Brent giving up.
IFAC: trying Shanks' SQUFOF, will fail silently if input
is too large for it.
SQUFOF: entering main loop with forms
(1, 171334115, -100054129) and (1, 383114729, -309626316)
of discriminants
29355379363049741 and 146776896815248705, respectively
SQUFOF: square form (1043^2, 169889007, -113321027) on first cycle
after 10626 iterations, time = 16 ms
SQUFOF: ...but the root form seems to be on the principal cycle
SQUFOF: square form (4375^2, 145836671, -105626707) on first cycle
after 12148 iterations, time = 0 ms
SQUFOF: found factor 154242059 from ambiguous form
after 6238 steps on the ambiguous cycle, time = 0 ms
IFAC: cofactor = 190320199
IFAC: factor 190320199
is prime
IFAC: factor 154242059
is prime
IFAC: prime 154242059
appears with exponent = 1
IFAC: main loop: 1 factor left
IFAC: prime 190320199
appears with exponent = 1
IFAC: main loop: this was the last factor[/CODE]

science_man_88 2010-09-13 11:51

this is only 127 units in because that's the maximum I can get working.

CRGreathouse 2010-09-13 13:46

[QUOTE=science_man_88;229554]this is only 127 units in because that's the maximum I can get working.[/QUOTE]

I can get 256
[code]v=vector(256);v[1]=276;for(i=2,#v,v[i]=sigma(v[i-1])-v[i-1])[/code]
in 1.825 seconds (1.903 if I turn on warnings and print out each index as I finish it). 512 takes about half a minute.

science_man_88 2010-09-13 13:47

I got it working further i think lol just make a for loop around the for loop existant and the equation v[1]==v[127] at every loop though maybe v[1]==v[#v] would work faster lol.

science_man_88 2010-09-13 13:54

with my extension method i got Aliquot(276) to 12601 in just over 11 seconds.

CRGreathouse 2010-09-13 13:56

[QUOTE=science_man_88;229562]I got it working further i think lol just make a for loop around the for loop existant and the equation v[1]==v[127] at every loop though maybe v[1]==v[#v] would work faster lol.[/QUOTE]

Checking v[1]==v[127] will take perhaps 10 cycles. Checking it a thousand times will take 10,000 cycles. If you're using a 500 MHz machine, this takes 20 microseconds.

Using v[1]==v[#v] involves also calculating #v, so it might take an extra 5 microseconds.

But the whole calculation for the first thousand terms will take an hour or more, I expect. So it really doesn't matter. Essentially all of the time (certainly more than 99,.99%) is spent factoring.

kar_bon 2010-09-13 13:57

[QUOTE=science_man_88;229564]with my extension method i got Aliquot(276) to 12601 in just over 11 seconds.[/QUOTE]

12601?

science_man_88 2010-09-13 13:58

how would we be able to extend your method so it can go higher.

science_man_88 2010-09-13 13:59

[QUOTE=kar_bon;229567]12601?[/QUOTE]

yep 100 * 127 -99 (lost to replacement) = (#v=12601) in 11 seconds.

CRGreathouse 2010-09-13 14:01

[QUOTE=science_man_88;229564]with my extension method i got Aliquot(276) to 12601 in just over 11 seconds.[/QUOTE]

I don't think I believe that. If 276 is the first member, 396 is the second member, and 21374326697892540932 is the 100th member, what do you get for members 200, 300, 400, ..., 2000?

kar_bon 2010-09-13 14:01

[QUOTE=science_man_88;229569]yep 100 * 127 -99 (lost to replacement) = (#v=12601) in 11 seconds.[/QUOTE]

Which value represent 12601?
The index of the sequence Aliquot(276), so 12601 iterations?

The first 100 iterations are [url=http://factordb.com/sequences.php?se=1&eff=2&aq=276&action=range&fr=0&to=100]here[/url].

science_man_88 2010-09-13 14:03

[CODE] Aliquot(n)= v=vector(1,x,n);for(b=1,100,for(a=2,127,d=Alistep(v[a-1]);v=concat(v,d);if(d==n || d==1,break()));v[1]==v[#v]);print(v)[/CODE]

once you do the alistep put in try this for yourself i got:

*** last result computed in 11,437 ms.

and no I didn't use debug though I've played around and found it has 20 levels.

CRGreathouse 2010-09-13 14:08

[code]Alistep(n)=sigma(n)-n
Aliquot(n)=my(v=vector(1,x,n),d);for(b=1,100,for(a=2,127,d=Alistep(v[a-1]);v=concat(v,d);if(d==n || d==1,break()));v[1]==v[#v]);v

>Aliquot(10)
%3 = [10, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1][/code]

So you're calculating something, but not the right thing.

science_man_88 2010-09-13 14:15

[QUOTE=CRGreathouse;229573][code]Alistep(n)=sigma(n)-n
Aliquot(n)=my(v=vector(1,x,n),d);for(b=1,100,for(a=2,127,d=Alistep(v[a-1]);v=concat(v,d);if(d==n || d==1,break()));v[1]==v[#v]);v

>Aliquot(10)
%3 = [10, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1, 8, 7, 1][/code]

So you're calculating something, but not the right thing.[/QUOTE]

it's because i forgot it's break(2) lol not break() that should be there.

never mind I see your point dang. but I think this still goes to 127 by the looks of it before repeating higher than the 100 list kar_bon gave me a link to.

science_man_88 2010-09-13 15:11

if it did the math correct these are the next ones:

[CODE]23780027782003162628, 27022045182026917372, 29800418252165873732, 30868734601205564812, 30868743536688997492, 31506186871079789708, 33685079263470335092, 37869561159553616108, 44810700265393440532, 52967010256293285740, 77368308005658962068, 77526798761623418732, 81730869595023949972, 81812211224085690348, 174495211883566827540, 383889841278567188460, 851420485964196743700, 2133148752623068133100, 4920463122717210500628, 9659030418601945179372, 19140499834691254267668, 31900833057818757113004, 60928733769254068230996, 101554467127566656249004, 169306878754562576009556, 282178131257604293349484[/CODE]

science_man_88 2010-09-13 15:16

never mind I didn't use my brain lol. how far would I have to go to find the 1 ot 276 ?

CRGreathouse 2010-09-13 15:18

[QUOTE=science_man_88;229586]never mind I didn't use my brain lol. how far would I have to go to find the 1 ot 276 ?[/QUOTE]

What do you want to find for each? The vector, the number of terms, the final prime, ...?

science_man_88 2010-09-13 15:21

I want to figure the whole thing out Aliquot sequence n. but if I have to settle for it maybe when it repeats or is terminated.

CRGreathouse 2010-09-13 15:28

[QUOTE=science_man_88;229588]I want to figure the whole thing out Aliquot sequence n. but if I have to settle for it maybe when it repeats or is terminated.[/QUOTE]

You could just do
[code]vector(274,n,Aliquot(n+1))[/code]
but you'll need to modify your program to look for loops, and you'll want some way to handle sequences that don't seem to terminate.

science_man_88 2010-09-13 15:40

[QUOTE=CRGreathouse;229589]You could just do
[code]vector(274,n,Aliquot(n+1))[/code]
but you'll need to modify your program to look for loops, and you'll want some way to handle sequences that don't seem to terminate.[/QUOTE]

that's what:

[CODE]if(d==n || d==1,break(2))[/CODE]
is supposed to do. check for repeats of n or 1. but I guess we'll have to check for every integer in v to find out for sure. so the main part missing is a way to scan through v and check for repeating of a single item that isn't n.

kar_bon 2010-09-13 15:47

Look [url=http://www.aliquot.de/aliquote.htm#diagrams]here[/url] for examples of cycles.

Why don't you read the links i gave in post #1411?

science_man_88 2010-09-13 16:10

I looked all of them over, I have no care to look over 1000's of threads to find any values to check i have no idea what to do obviously, so I'm of no use regardless.

kar_bon 2010-09-13 16:32

That's how I would and do it:

- read more about the problem to understand things like input, output, exceptions
- try an example by hand/calculator to verify if I understand the problem correct and check against other examples found somewhere
- try to find a simple algorithm in the computer language I want to use: datatypes, a simple flow chart, ignoring for first exceptions but only run and give a result
- write the program
- testing the program with my own examples and verify against others
- try to cover the exceptions
- testing again
- optimize (if needed/wanted) the code
- testing again
- in all steps, documenting is essential
-> after all this is done, realease the code/program to others, let them test, too
-> final release

Finding the algorithm and code is the least part of all.
Exceptions or misuse/false inputs are quite more.
The most time is testing and find the limits of the code, emilminate those errors a user can cause and the documentation.

science_man_88 2010-09-13 16:39

inputs are n the number to find the sequence to: the only failure in my code is not checking over v.

science_man_88 2010-09-15 21:41

[CODE]...for(y=1,#v-1,if(d==v[y] || d==1,break(3)))...[/CODE]

is the best thing I can think of lol to replace it with

and I still now get about the temp directory error:

[CODE]sigma: couldn't find a suitable name for a tempdir (MPQS).[/CODE]

CRGreathouse 2010-09-15 22:06

[QUOTE=science_man_88;229888]and I still now get about the temp directory error:

[CODE]sigma: couldn't find a suitable name for a tempdir (MPQS).[/CODE][/QUOTE]

This is clearly a problem in the factoring system. Looking through the source I can see that the message is printed by pari_unique_dir when none of the 600+ temporary directory names it tries to make can be created (for example, they already exist).

This function is called only in the MPQS initialization (mpqs_i).

science_man_88 2010-09-15 22:10

[QUOTE=CRGreathouse;229890]This is clearly a problem in the factoring system. Looking through the source I can see that the message is printed by pari_unique_dir when none of the 600+ temporary directory names it tries to make can be created (for example, they already exist).

This function is called only in the MPQS initialization (mpqs_i).[/QUOTE]

think it's because for some reason i can't write a new file to my main drive at least one level down lol

science_man_88 2010-09-15 22:18

1 Attachment(s)
I get the error below:

CRGreathouse 2010-09-15 23:11

[QUOTE=science_man_88;229892]think it's because for some reason i can't write a new file to my main drive at least one level down lol[/QUOTE]

Well, until you fix that problem you're not going to be able to use MPQS in Pari, since that requires the creation of temportary files and folders.

science_man_88 2010-09-15 23:16

[QUOTE=CRGreathouse;229903]Well, until you fix that problem you're not going to be able to use MPQS in Pari, since that requires the creation of temportary files and folders.[/QUOTE]

is it not possible to get it to write to my portables ? all of them work well last I checked.

CRGreathouse 2010-09-16 00:16

[QUOTE=science_man_88;229906]is it not possible to get it to write to my portables ? all of them work well last I checked.[/QUOTE]

Hmm. It looks like you could make it work if you changed the environment variable "TEMP" to point to your portable drive, it would work. You *may* be able to do this:

[code]@echo off
REM ************************************************
REM * Put this in a file called pari.bat *
REM * Change F:\ to your portable's drive letter *
REM * Change C:\Program... as needed *
REM ************************************************
set TEMP=F:\tmp
cd "C:\Program Files\PARI"
gp[/code]

but I'm not at a Windows machine at the moment so I can't test it.

science_man_88 2010-09-16 00:36

[QUOTE=CRGreathouse;229911]Hmm. It looks like you could make it work if you changed the environment variable "TEMP" to point to your portable drive, it would work. You *may* be able to do this:

[code]@echo off
REM ************************************************
REM * Put this in a file called pari.bat *
REM * Change F:\ to your portable's drive letter *
REM * Change C:\Program... as needed *
REM ************************************************
set TEMP=F:\tmp
cd "C:\Program Files\PARI"
gp[/code]

but I'm not at a Windows machine at the moment so I can't test it.[/QUOTE]

tell me where to put it in Pari directory ?

CRGreathouse 2010-09-16 01:47

[QUOTE=science_man_88;229915]tell me where to put it in Pari directory ?[/QUOTE]

You can put it anywhere you like, then run it by double-clicking. Be sure that the directories are right, though -- your Pari directory may be "C:\Program Files (x86)\PARI", for example, rather than what I wrote above. Of course getting the temp directory correct is critical in this case. (You probably also need to create the directory on F:\ or whatever.)

science_man_88 2010-09-16 11:39

[QUOTE=CRGreathouse;229911]Hmm. It looks like you could make it work if you changed the environment variable "TEMP" to point to your portable drive, it would work. You *may* be able to do this:

[code]@echo off
REM ************************************************
REM * Put this in a file called pari.bat *
REM * Change F:\ to your portable's drive letter *
REM * Change C:\Program... as needed *
REM ************************************************
set TEMP=F:\tmp
cd "C:\Program Files\PARI"
gp[/code]

but I'm not at a Windows machine at the moment so I can't test it.[/QUOTE]

well I can't go above 127 without the error and that's when it comes up lol.


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

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