Math Questions

Discuss anything related to the VIC
Post Reply
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Math Questions

Post by Jeff-20 »

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?
High Scores, Links, and Jeff's Basic Games page.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

I would say 3, 6, 9.
Then 2, 3, 5, 7,...
Sieve of Eratosthenes?
wimoos
Vic 20 Afficionado
Posts: 349
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Post by wimoos »

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)
Last edited by wimoos on Mon Jul 27, 2009 2:30 am, edited 1 time in total.
User avatar
Mike
Herr VC
Posts: 4842
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

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
Last edited by Mike on Mon Jul 27, 2009 4:28 am, edited 1 time in total.
ravenxau
Vic 20 Devotee
Posts: 296
Joined: Fri May 28, 2004 10:03 pm

Post by ravenxau »

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...)
Android Tablet running Frodo 64 emulator running VIC 20 emulator....
User avatar
Mike
Herr VC
Posts: 4842
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

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 ...
as for the rest, it's pretty open to debate (the best thing about theoretical maths,
... 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.

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.
gklinger
Vic 20 Elite
Posts: 2051
Joined: Tue Oct 03, 2006 1:39 am

Re: Math Questions

Post by gklinger »

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?
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?
Problem 2: Prime numbers! Do you count 1?
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.
In the end it will be as if nothing ever happened.
User avatar
pitcalco
just pitcalco
Posts: 1272
Joined: Wed Dec 28, 2005 4:13 pm
Location: Berlin

Post by pitcalco »

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
English Invader
Vic 20 Scientist
Posts: 1193
Joined: Tue Apr 28, 2009 3:51 pm

Post by English Invader »

Radio DJ: Which sixties pop group was known as the Fab Four?

Butt-Head: Math was always my worst subject.
User avatar
Mike
Herr VC
Posts: 4842
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

pitcalco wrote:Zero divided by any number (except zero) is always zero.
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.

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? ;)
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

It was just a personal programming issue. The vic doesn't use math the way I do. I would explain more but I'm typing ony iPhone because I am too far from people and civilization at the moment. The question will make sense later. Haha
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Are you implying the VIC-20 isn't the Friendly Computer after all? :lol:
Anders Carlsson

Image Image Image Image Image
gklinger
Vic 20 Elite
Posts: 2051
Joined: Tue Oct 03, 2006 1:39 am

Post by gklinger »

Jeff-20 wrote:I would explain more but I'm typing ony iPhone because I am too far from people and civilization at the moment.
Geez. Vancouver isn't that bad. :)
In the end it will be as if nothing ever happened.
User avatar
Mike
Herr VC
Posts: 4842
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Jeff-20 wrote:I'm typing on my iPhone because I am too far from people and civilization at the moment.
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. :lol:
Post Reply