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)

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


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

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