Well you have to add separators and an if statement. I would do something
like
for i = 3 to 100 do (
a = sqrt(i^3);
if IsInteger(a) and IsPrime(a) then (
print("i=" + i +", i^3=" + (i^3) + ", a=" + a)
)
)
Of course this will not print anything since there is no such a. This would
imply a^2=i^3 where a is a prime, and this is impossible for an integer i by
uniqueness of prime factorization.
Jiri
On Mon, Dec 6, 2010 at 9:01 AM, FESTINGER GEORGES <gfdph_at_yahoo.fr> wrote:
> Bonjour
> I have just a small program to write in gel:
> for i = 3 to 100 do (
> print(sqrt(i^3)))
>
> this one works, but I would like to display only the results integers.
>
> for i = 3 to 100 do (
> a = sqrt(i^3)
> IsInteger(a) = true
> print i, i^3,c (I wrote it as in language BASIC)
>
> and one more condition
> IsInteger(a) AND IsPrime(a) = true
>
> Sorry to disturb you for so elementary program.
> If you could put in the manual or in other part more examples of small
> program it could be easier for a beginner to learn the syntax of GEL.
>
> Merci beaucoup pour GENIUS qui semble assez simple à utiliser quand on a
> compris la syntaxe.
>
>
> --
> to unsubscribe:
> send mail to minimalist_at_5z.com with "unsubscribe genius-list" in the
> subject
>
>
-- Jiri (George) Lebl, http://www.math.ucsd.edu/~jlebl/<http://www.math.ucsd.edu/%7Ejlebl/>or http://www.jirka.org/Received on Mon Dec 06 2010 - 16:27:47 CST
This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:00:03 CDT