Source-Changes-D archive

# Re: CVS commit: src/games/factor

```On Sun, May 16, 2010 at 02:10:35PM +0400, Aleksej Saushev wrote:
[...]
> > So nothing about algebra stops you factoring negative numbers.
> > However, since the 'prime factors' should be prime numbers, they
> > shouldn't include -1, but maybe the smallest factor should be negative.
>
> While it may be controversial whether to count 1 and -1 as prime,
> it is perfectly sensible to do so.

I'm surprised to see so little common sense in all the discussions about
factor(6).  The reasons why 1, -1 or negative numbers are not defined as
prime really is a matter of convenience.  Think of all the theorems that
start with "let p be an odd prime", and now imagine what would happen to
all other theorems involving primes if some numbers that are on the
fence were added to the list.  So really it's just a matter of making
maths books thinner.

The question you people should ask is not whether factor(6) is
biblic^Wmathematically correct, but what definition of a prime number
would make it most useful.  I don't see why it would have to be the one
found in algebra books.

I can probably count the times I've used factor(6) with my fingers, and
I'd be surprised if it wasn't also the case for all the people who
shared a piece of their mind on the subject here.  Heck, I'd bet some of
you have posted more mails in those two threads than they had actual

Honestly, I don't see anyone doing stricto sensu maths on a computer
limiting their tools to NetBSD'd games.tgz.

So factor(6) is a tool of very limited utility, a convenience that one
uses only a few times and far-between.  Therefore I think it is very
arrogant to make it fail on any numerical input.  The likely source for
input for factor(6) is a cut-and-paste, or the end of a pipeline
crunching some numbers.  Do you really want to annoy the occasional
users by making factor(6) something that is insulted that the user dared
giving it 0, 1, or a negative number?

All in all, it seems to me that Aleksej's position is probably the most
practical one, therefore the most likely to be useful.

--
Quentin Garnier - cube%cubidou.net@localhost - cube%NetBSD.org@localhost
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.
```

Attachment: pgpT9WEZbvITZ.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index