Nested If

• To: mathgroup at smc.vnet.net
• Subject: [mg92779] Nested If
• From: Artur <grafix at csl.pl>
• Date: Mon, 13 Oct 2008 06:18:02 -0400 (EDT)

```Dear Mathematica Gurus,
Who know how nested or folded multiple If procedure in following:

{m1, m2, m3, m4, m5, m6, m7, m8,  m9} = {-1, -1, -1, -1, -1, -1, -1, -1,
-1}; Do[
If[Mod[n, 2] == 0, m1 = m1 + 1,
If[Mod[n, 3] == 0, m2 = m2 + 1,
If[Mod[n, 5] == 0, m3 = m3 + 1,
If[Mod[n, 7] == 0, m4 = m4 + 1,
If[Mod[n, 11] == 0, m5 = m5 + 1,
If[Mod[n, 13] == 0, m6 = m6 + 1,
If[Mod[n, 17] == 0, m7 = m7 + 1,
If[Mod[n, 19] == 0, m8 = m8 + 1,
If[Mod[n, 23] == 0, m9 = m9 + 1]]]]]]]]], {n, 1,   6!}];
Print[{m1, m2, m3, m4, m5, m6, m7, m8, m9}]

I want nested 9 times If[Mod[n,Prime[k]]==0,m[k]=m[k]+1],{k,1,9}]

I will be greatfull for any idea!

Best wishes
Artur

```

• Follow-Ups:
• Prev by Date: Solve vs. NSolve
• Next by Date: Re: Export as PDF without " for strings
• Previous by thread: Re: error region in parametric plot
• Next by thread: Re: Nested If