5 ms·
all of which have prime factors ;) besides, you may as well consider 1 a prime factor. the task is just a silly programming toy problem. 1 not being prime is p
by wayn3 9y ago
all of which have prime factors ;)
besides, you may as well consider 1 a prime factor. the task is just a silly programming toy problem. 1 not being prime is pure definition, including 1 in the primes would not materially change the definition of primes. just make a lot of advanced math tedious to write down.
- drdeca 9y agoIf you changed the definition of "prime numbers" so that it included 4, but was otherwise the same, you could also change other statements and definitions to account for this. It would be entirely unreasonable to say that 4 might as well be considered a prime number because of this.
- gizmo686 9y agoThe Real numbers do not have any primes. Every real number is a unit. EDIT: Because it gets brought up so often, I want to respond directly to the 1 being prime point. Saying this is true purely by definition is only true in the highly technical sense that we could make the definition whatever we want. One of the core properties of primes is Euclid's lemma, which states that if p is a prime and p divides xy then p divides x or p divides y. Symbolic, this is p|xy => p|x OR p|y. Indeed when we generalize the notion of "prime" from the integers to arbitrary rings, this "lemma" becomes part of the definition. In fact, even "irreducible" elements, which is a strictly weaker requirement than prime elements, excludes units (such as 1).
- gjm11 9y agoThe property "p|xy => p|x or p|y" does in fact hold for p=1. (The conditions on the LHS and RHS are then true for all x,y.) The simplest formulation of the condition for irreducibility (p=qr => q=1 or r=1) is also true for p=1. Taking 1 not to be prime is, none the less, pretty clearly better than the alternative. Here are a few examples of neat things that would break if we took 1 to be prime: When p is prime Z/pZ -- i.e., "integers mod p" -- is a field, meaning a thing in which you can do +,-,*,/. This would be false if we allowed p=1, though admittedly there's a not-too-crazy way you could change the usual definition of "field" that would fix it. The "fundamental theorem of arithmetic": Every positive integer is the product of primes and this product is unique up to rearrangement. This would be false if we took 1 to be prime, because you can always add or remove 1s from the factorization. The famous Riemann zeta function (zeta(s) = sum over positive integers n of n^-s) has a representation as an infinite product: zeta(s) = product over prime p of (1-p^-s)^-1. For a little example of why this is nice, note that it provides an instant proof that there are infinitely many primes, because as s->1 zeta(s)->infinity, which would be impossible if that were a finite product. This would become nonsense if we allowed p=1 because one factor would then be 1/0. Prime numbers all have exactly two divisors (1 and p). This would become false if we took 1 to be prime.
- e12e 9y agoWhat are the prime factors of "-e+i"? My point was that if we're being pedantic, "numbers" is a very general term - positive integers, not so much.