Math Questions
Math Questions
I'm not the best math guy, but I asked a few friends and got different answers.
Problem 1: If you wanted to name all single digit multiples of 3, would you say 3,6,9? or 0,3,6,9? or just 6,9? I tend not to include zero, but the computer would. And one of my friends didn't even include three because she thinks of "multiples" as meaning beyond the number itself! Which is the best answer to you?
Problem 2: Prime numbers! Do you count 1? Would single digit prime numbers be 2, 3, 5, 7? or 1, 2, 3, 5, 7? Is zero not even considered because it's not a "natural number" ?
Finally, what is a quick way to make the VIC determine a prime number in BASIC?
Problem 1: If you wanted to name all single digit multiples of 3, would you say 3,6,9? or 0,3,6,9? or just 6,9? I tend not to include zero, but the computer would. And one of my friends didn't even include three because she thinks of "multiples" as meaning beyond the number itself! Which is the best answer to you?
Problem 2: Prime numbers! Do you count 1? Would single digit prime numbers be 2, 3, 5, 7? or 1, 2, 3, 5, 7? Is zero not even considered because it's not a "natural number" ?
Finally, what is a quick way to make the VIC determine a prime number in BASIC?
-
- Vic 20 Afficionado
- Posts: 349
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
When trying for a number to be prime there's no reason to test any further than the square root of that number.
When "even" is also ruled out then you have a pretty Q&D algo.
10 input x
20 if x/2=int(x/2) then (no prime)
30 for i=3 to sqr(x) step 2
40 q=x/i:if q=int(q) then (no prime)
50 next
60 (prime)
When "even" is also ruled out then you have a pretty Q&D algo.
10 input x
20 if x/2=int(x/2) then (no prime)
30 for i=3 to sqr(x) step 2
40 q=x/i:if q=int(q) then (no prime)
50 next
60 (prime)
Last edited by wimoos on Mon Jul 27, 2009 2:30 am, edited 1 time in total.
- Mike
- Herr VC
- Posts: 4842
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
1. Whether 0 is counted to the natural numbers, or not, depends on your Maths professor.
At least the concept of zero is not quite self-evident: one might "naturally" count one, two, three, or more occurences of a thing, but it takes a fundamental abstracting step to name that no-thing of some kind is present: the Indian word for zero - sunya - means "empty".
2. Neither "0", nor "1" are counted as prime numbers. This is because any non-prime number (except 0 and 1) has an unique factorisation into a product of prime-numbers: for example - 2 x 5 = 10, 2 x 2 x 3 = 12, 5 x 7 = 35, ...
A permutation of factors (as in 5 x 2 = 10) is not taken into account, since multiplication is commutative.
If one would include 1, the above theorem would be false, since: 2 x 1 = 2, but also 2 x 1 x 1 = 2, 2 x 1 x 1 x 1 = 2, ... . And 0 cannot be included either, because 0 in a factorisation only can produce 0 as result.
Greetings,
Michael
At least the concept of zero is not quite self-evident: one might "naturally" count one, two, three, or more occurences of a thing, but it takes a fundamental abstracting step to name that no-thing of some kind is present: the Indian word for zero - sunya - means "empty".
2. Neither "0", nor "1" are counted as prime numbers. This is because any non-prime number (except 0 and 1) has an unique factorisation into a product of prime-numbers: for example - 2 x 5 = 10, 2 x 2 x 3 = 12, 5 x 7 = 35, ...
A permutation of factors (as in 5 x 2 = 10) is not taken into account, since multiplication is commutative.
If one would include 1, the above theorem would be false, since: 2 x 1 = 2, but also 2 x 1 x 1 = 2, 2 x 1 x 1 x 1 = 2, ... . And 0 cannot be included either, because 0 in a factorisation only can produce 0 as result.
Greetings,
Michael
Last edited by Mike on Mon Jul 27, 2009 4:28 am, edited 1 time in total.
3 is not a multiple of 3 - multiple implies at least 2 of something - therefore the first multiple of 3 is 6 (2x3=6) - also factors and multiples are only supposed to include whole numbers (I may be wrong on this, tho).
as for the rest, it's pretty open to debate (the best thing about theoritical maths, quantum physics..etc...)
as for the rest, it's pretty open to debate (the best thing about theoritical maths, quantum physics..etc...)
Android Tablet running Frodo 64 emulator running VIC 20 emulator....
- Mike
- Herr VC
- Posts: 4842
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Any number N that can be written as 3 x n = N, with n being a natural number is a multiple of 3. There's no good reason to exclude n=1, and n=0 from that list.
Of course it doesn't make any sense to allow arbitrary fractions, or real numbers for n, since that would make any number a multiple of 3.
As for this ...
They're axioms and cannot be derived from anything. But they produce a faithful representation of how natural numbers "work" from a minimal set of assumptions:
1) 0 is a number,
2) every number has a successor,
3) 0 is not a successor of a number,
4) different numbers have different successors,
5) of all sets, that include 0, and with every number also its successor, the set of natural numbers is the smallest one.
The last axiom infers the method of Mathematical induction.
Of course it doesn't make any sense to allow arbitrary fractions, or real numbers for n, since that would make any number a multiple of 3.
As for this ...
... Mathematics pretty much has settled on Peano's axioms defining the natural numbers for more than 100 years, which include 0 as neutral element for addition.as for the rest, it's pretty open to debate (the best thing about theoretical maths,
They're axioms and cannot be derived from anything. But they produce a faithful representation of how natural numbers "work" from a minimal set of assumptions:
1) 0 is a number,
2) every number has a successor,
3) 0 is not a successor of a number,
4) different numbers have different successors,
5) of all sets, that include 0, and with every number also its successor, the set of natural numbers is the smallest one.
The last axiom infers the method of Mathematical induction.
Re: Math Questions
I would say 0, 3, 6 and 9 because 3 x 0 = 0 and 3 x 1 = 3 and therefore both meet the condition set out in your question. Although not mentioned, -3, -6 and -9 would also seem to qualify, no?Jeff-20 wrote:Problem 1: If you wanted to name all single digit multiples of 3, would you say 3,6,9? or 0,3,6,9? or just 6,9?
No. By the currently accepted definition 1 is not a prime number. Read up on the "primality of one" if you wish to understand why.Problem 2: Prime numbers! Do you count 1?
In the end it will be as if nothing ever happened.
zero is not a prime number but not for the same reason as the number one, but quite simply that it can be evenly divided into any number. Zero divided by any number (except zero) is always zero. Conversely, any number multiplied by zero is equal to zero so it has an infinite number of factors.
There are only three kinds of people in the world: those who can count and those who can't.
Paul Lambert
Berlin
Federal Republic of Germany
Paul Lambert
Berlin
Federal Republic of Germany
-
- Vic 20 Scientist
- Posts: 1193
- Joined: Tue Apr 28, 2009 3:51 pm
- Mike
- Herr VC
- Posts: 4842
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Correct. The division by 0 - a 0 as nailed-on number, not a limit - isn't allowed anyway, regardless of the number being divided is non-0, or 0.pitcalco wrote:Zero divided by any number (except zero) is always zero.
Michael
P.S.: This topic strikes me as not specifically relevant to VIC-20 programming, software, games, hardware, or trading. Maybe the OP could move it into the Off-topic section?
- Mike
- Herr VC
- Posts: 4842
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
It can't be too far away from civilization, since the text found its way to here. The need for using RFC1149 might be a better excuse.Jeff-20 wrote:I'm typing on my iPhone because I am too far from people and civilization at the moment.