MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help with "If" statement within "Table"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90536] Re: [mg90500] Help with "If" statement within "Table"
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Sat, 12 Jul 2008 05:31:49 -0400 (EDT)
  • References: <200807110602.CAA03738@smc.vnet.net> <AF433FAE-AA34-4766-A834-B78AD4B87890@jeol.com> <a851af150807110720v318a2d12v729250b1380747e8@mail.gmail.com>

On Jul 11, 2008, at 10:20 AM, Diana Mecum wrote:

> SSeziwa,
>
> Thanks. Yes, I did initialize the list as follows. I padded the  
> terms with 2's, and started with the 12th term.
>
> A136164 = {0, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2}
> A136164 = PadRight[A136164, 1000, 2];
> Table[If[CoprimeQ[Divisors[n][[j]], Divisors[n][[j - 1]]] ||
>     CoprimeQ[Divisors[n][[j]], Divisors[n][[j + 1]]],
>    A136164[[n]] = A136164[[n]] + 1], {j, 3, Length[Divisors[n]] - 2}];
>
> If I execute the "If" statement outside of the table, the sequence  
> elements are updated. For example,
>
> n=12
> j=3
> If[CoprimeQ[Divisors[n][[j]], Divisors[n][[j - 1]]] ||
>   CoprimeQ[Divisors[n][[j]], Divisors[n][[j + 1]]],
>  A136164[[n]] = A136164[[n]] + 1]
>
> With this, the sequence gets updated.

n doesn't have a value in your first set of statements.  Is this part  
of a larger program?

Regards,

Ssezi


  • Prev by Date: Stop iteration iconstructing Table
  • Next by Date: Re: Defining Functions and Simplifying Solutions
  • Previous by thread: Help with "If" statement within "Table"
  • Next by thread: Re: Help with "If" statement within "Table"