Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Creating a List using Loop/Table' topicStudent Support Forum > General > Archives > "Creating a List using Loop/Table"

Next Comment >Help | Reply To Topic
Author Comment/Response
Kim Chris
07/23/12 2:16pm

I need to output a list of {i,j} where i is held constant while j loops from 1 to n, then i is increased by 1 and the process is repeated. The list should look like {{1,1}, {1,2},...{1,n}, {2,1}, {2,2}}, and so on until {n,n}.

I have tried using Table[{i, j}, {i, 1, 20}, {j, 1, 20}], but this outputs with dimensions {20,20,2}. I need a list of 400 elements in a row, not 20 lists of 20 elements.

I also briefly tried using For, but I have no experience with this and couldn't output a list.

Any help would be greatly appreciated.

Thanks,

URL: ,

Subject (listing for 'Creating a List using Loop/Table')
Author Date Posted
Creating a List using Loop/Table Kim Chris 07/23/12 2:16pm
Re: Creating a List using Loop/Table Bill Simpson 07/24/12 00:40am
Next Comment >Help | Reply To Topic