Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Help with While Loop Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115924] Help with While Loop Function
  • From: KenR <ramsey2879 at msn.com>
  • Date: Wed, 26 Jan 2011 05:04:26 -0500 (EST)

Please Help me to Get the following to work as desired
t is the triangular number. I increment it repeated ly by adding the
counter x to it. When t*((y^2+1)/2)^2 + y^2 is a perfect square i want
to append t to my list of trangular numbers with the list starting
with {0,1}, and exit the loop when 3 more triangular numbers have been
added or when t >= 1000000000000. It is not working for me. I am new
to Mathematica. Thanks

Clearall[x,y,t,w]
x = 2
y = 3
t = 1
w = 0
List1 = {0,1}
f[t_,y_] ==(Floor(Sqrt ((t/4) (y^2-1)^2 + y^2)))^2 - ((t/4) (y^2-1)^2
+ y^2)
While[t<1000000000000,t = t+x;If[f[t,y] = 0, List1 = Append[list1,t];w
= w +1];
If [w = 3,t = 1000000000000, x++]];
List1


  • Prev by Date: Re: Vector problem
  • Next by Date: Re: Need help with Mathematica
  • Previous by thread: Re: Vector problem
  • Next by thread: Re: Help with While Loop Function