Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: Bug ???


Artur wrote:

> Why doesn't work:
> a={};Do[k=n^2-(Floor[n^2(2/3)])^2;If[k=0,
> AppendTo[a,{k,n^2}]],{n,1,1000}];a
<snip>

A single equal sign, =, sets the value of the LHS.
A double equal sign, ==, tests for equality.

Evaluating

a = {}; Do[k = n^2 - (Floor[n^2 (2/3)])^2;
  If[k == 0, AppendTo[a, {k, n^2}]], {n, 1, 1000}]; a

returns {{0, 4}}

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Bug ???
  • Next by Date: Re: Bug ???
  • Previous by thread: Re: Bug ???
  • Next by thread: Re: Bug ???