Help with "If" statement within "Table"

*To*: mathgroup at smc.vnet.net*Subject*: [mg90500] Help with "If" statement within "Table"*From*: Diana <diana.mecum at gmail.com>*Date*: Fri, 11 Jul 2008 02:02:26 -0400 (EDT)

Folks, I am trying to write a small program to count the number of divisors of a number which have at least one coprime neighbor, and secondly the number of divisors which have two coprime neighbors, (one on each side). For example, the divisors of 60 are {1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60}. 6 of the divisors have at least one coprime neighbor, and 5 of the divisors have two coprime neighbors. In doing this, I have written the following statement. "n" is the number for which I am calculating divisors, and "A136164" is my first list, the of number of divisors in the "at least one neighbor" case. For some reason, A136164 is not updating when the "If" statement is executed within the "Table" statement. Can someone help me? Thanks, Diana M. 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}];

**Follow-Ups**:**Re: Help with "If" statement within "Table"***From:*"Diana Mecum" <diana.mecum@gmail.com>

**Re: Help with "If" statement within "Table"***From:*Sseziwa Mukasa <mukasa@jeol.com>

**Re: Help with "If" statement within "Table"***From:*Andrzej Kozlowski <akoz@mimuw.edu.pl>