If we have a list:

Code:

ʟ1
{1,2,3,0,0}


and I am trying to repeat the values to fill the remaining values, like so:


Code:

ʟ2
{1,2,3,1,2}


how would I do that? Here is my current algorithm:


Code:

dim(ʟ2)→dim(ʟ1)

For(X,1,dim(ʟ2)-dim(ʟ1)
ʟ1(X-dim(ʟ1+1)→ʟ1(X)
End


It has some kind of logical error, it doesn't really do anything to the two lists' values.

Please help, I don't know if I have explained this very well but if I have not I can elaborate.

-Silverwings11
You can achieve this by using modulo, which is remainder(A,B) on the new Ti 84+ and B*fPart(A/B) on the old Ti 83 devices:

Code:
Prompt L1
Disp “Pls enter the dim of the new list“
Prompt A
L1->L2
For(I,dim(L1)+1,A
L1(1+remainder(I-1,dim(L1->L2(I
End
Disp L2

It may not be the fastest method, but it works
E.g. when you enter {1,2,3 as L1 and 5 as dim (A), it puts out {1,2,3,1,2
I hope that is what you were looking for...
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement