Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: skipping some i, j , ... values in Table
Replies: 3   Last Post: May 19, 2013 5:47 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Bob Hanlon Posts: 906 Registered: 10/29/11
Re: skipping some i, j , ... values in Table
Posted: May 19, 2013 5:47 AM
 Plain Text Reply

sol = something @@@
DeleteCases[
Flatten[
Table[{i, j}, {i, 10}, {j, 10}],
1],
_?(PrimeQ[Total[#]] &)];

or

sol == something @@@
Select[
Flatten[
Table[{i, j}, {i, 10}, {j, 10}],
1],
! PrimeQ[Total[#]] &]

True

Bob Hanlon

On Sat, May 18, 2013 at 2:39 AM, Andre Hautot <ahautot@ulg.ac.be> wrote:

>
> Hi,
> Suppose I need a list, Flatten[Table[something[i,j],{i,10},{j,10}]],
> where some combinations of indices i and j are voluntarily missing under
> a known condition (for example, stupid I know, when i+j is a prime).
> How can I do that ?
> Thanks in advance,
> ahautot
>

Date Subject Author
5/19/13 Sseziwa Mukasa
5/19/13 Bob Hanlon
5/19/13 James Stein

© The Math Forum at NCTM 1994-2016. All Rights Reserved.