gcd between three numbers?

127 views
Skip to first unread message

rpmu...@gmail.com

unread,
Feb 13, 2008, 9:51:20 PM2/13/08
to sage-newbie
I know how to compute the gcd between two numbers, but I don't know a
simple way to compute the gcd between three numbers. Is there an easy
way?

Mike Hansen

unread,
Feb 13, 2008, 9:58:36 PM2/13/08
to sage-...@googlegroups.com
Mathematically, you have that gcd(a,b,c) == gcd(gcd(a,b),c). In Sage,
you can just do one of the following:

sage: gcd(6,12,24)
6
sage: gcd([6,12,24])
6

--Mike

rpmu...@gmail.com

unread,
Feb 14, 2008, 8:55:06 AM2/14/08
to sage-newbie
Thanks. It seems so obvious, now.

On Feb 13, 7:58 pm, "Mike Hansen" <mhan...@gmail.com> wrote:
> Mathematically, you have that gcd(a,b,c) == gcd(gcd(a,b),c). In Sage,
> you can just do one of the following:
>
> sage: gcd(6,12,24)
> 6
> sage: gcd([6,12,24])
> 6
>
> --Mike
>
Reply all
Reply to author
Forward
0 new messages