Phuongha on Sat, 15 Jun 2013 15:16:54 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Enumerating and eliminating


Could you please help me to enumerate and eliminate elements of a set?
For example, from a loop:
for(k=1,10,x=k+3;if(x<10,print(x," ",k)))
I get the result:
4 1
5 2
6 3
7 4
8 5
9 6
And I want to enumerate the values of x as x[1]=4,....,x[6]=9.

Another example:
for(k=1,5,if(k<3,y=k,y=k-2);print(y))
and the result:
1
2
1
2
3

Here I have 2 values of y are repeated (1 and 2) and I would like to 
eliminate them and write a set A={value of y}={1,2,3} and then enumerate the 
values of y as y[1]=1,y[2]=2,y[3]=3...

However, I do not know how to do this @@.
I wonder if there is someone help me solve it?

Thank you so much.
Phuong Ha.