Saturday, May 16, 2009

Greatest Common Divisor (GCD), Least Common Multiple (LCM)

This calculator takes two numbers and finds the greatest common divisor and the least common multiple. If you multiply the gcm by the lcd you get the same as multiplying the two original numbers.

Friday, May 1, 2009

Prime Factors Calculator

I made this javascript prime factors calculator and have found it addictive. I just keep factorizing numbers. Enter the number to factorize in the left box and click on the 'factorize' button. The prime factors are shown in the right box.


I've never had a push button prime factor generator before.

You can easily check if a number is prime. It only has one prime factor: itself.

It's easy to generate a large prime number. Just type in a long random number and get its prime factors. If one of the factors is large, you've found a large prime number. If you don't get one, try changing your random number slightly.

For example: 384339387 gives 3,37,3462517. So 3462517 is a nice large prime number.

I like adding an extra digit and seeing what factors come out:

numberprime factors
1111
1113,37
111111,101
1111141,271
1111113,7,11,13,37
1111111239,4649
1111111111,73,101,137
1111111113,3,37,333667
111111111111,41,271,9091
1111111111121649,513239
1111111111113,7,11,13,37,101,9901

All the numbers with an even number of ones have the factor 11. And those with 4, 8 and 12 ones have factors of 11 and 101 because 1111 = 11 X 101.

Those with an odd number of ones have only two prime factors, except 111111111 (nine ones). I wonder if there's something going on here?

Oh no, the next number lets me down: 1111111111111 has factors 53,79 and 265371653.

If you find any interesting patterns with this prime factors calculator, let me know.

Wednesday, April 22, 2009

The Numbers go Social Networking

Names and photos are clickable.

Pythagoras is thinking that a2 + b2 = c2
for right angled triangles.

12 hours ago · Comment · Like
Natural at 10am on 14 April
Likes this!
Rational at a ¼ past 10 on 14 April
like 3,4,5 & 20,21,29
Natural at 11am on 14 April
Yeah!
Rational at ½ past 11 on 14 April
Just thought of another: ⅗, ⅘, 1
Natural at 12pm on 14 April
is confused
Real at 12:07 on 14 April
1, 1, √2 and 1, √3, 2 makes me think of sin and cos
Natural at 1pm on 14 April
is frightened
Complex at 13:07 + 00:03i on 14 April
I don't get it.
Pythagoras at 13:23 on 14 April
Sorry Complex, how about |a|2 + |b|2 = |c|2
Irrational at 32:07 on 12 April
That's just what Hitler did, you commie!
Complex at 13:52 on 14 April
Let's see... 8 + 4i, -3 + 6i, 5 + 10i. Yes!!!
Complex and Pythagoras are now friends.
11 hours 23i minutes ago · Comment · Like
Pythagoras has shared some photos.
11 hours ago · Comment · Like
Pythagoras is dividing a circle's circumference by its diameter.
9 hours ago · Comment · Like
Transcendental at e/4 pm on 14 April
Likes this!
Natural at 1pm on 14 April
I know this one. It's three.
Rational at ½ past 1 on 14 April
lol. you're way off, it's 22/7, no wait... 355/113
Transcendental at π/2 pm on 14 April
feels superior
Rational has invited Natural to the group Irrationality is the square root of all evil.
8½ hours ago · Comment · Like
Natural at 2pm on 14 April
doesn't like this.
Irrational has joined the group Irrationality is the square root of all evil.
√59 metres ago · Comment · Like
Pythagoras Is zero a number?
7 hours ago · Comment · Like
Rational at ¼ past 2 on 14 April
Yes
Real at 14:27 on 14 April
yes
Natural at 3pm on 14 April
yes
Irrational at 1 ABY
Han definately shot first
Complex at 15:07 + 00:08i on 14 April
Yes (to zero, not to Han)
Irrational at stardate -313713.3276255709
I've watched it over √17354 times and in reverse. Han shot first. That's what I'd do.
Pythagoras at 15:57 on 14 April
ok, ok, I get it. Zero is a number.
Irrational at 19:07 on 14 April
and Han shot first.
Integer took the quiz What sort of Infinity are you?
The answer is Countable. You are countable. You can be lined up one-to-one with the natural numbers.

4 hours ago · Comment · Like
Natural at 7pm on 14 April
Likes this!
Natural has invited Integer, Complex and Irrational to join the group Become more natural: square yourself
3 hours ago · Comment · Like
Pythagoras Anyone out there know the square root of minus one?
3 hour ago · Comment · Like
Rational at ½ past 7 on 14 April
what's a square root?
Imaginary at 20:27i on 14 April
sqrt of -1 is i
Complex at 20:28 + 0.01i on 14 April
and -i
Imaginary at 20:30i on 14 April
oh yeah, -i too
Quaternion at 21:07 + 00:29ijk on 14 April
i, -i, j, -j, k and -k
Pythagoras at 20:57 on 14 April
Show off
Natural at 9pm on 14 April
what's minus one?
Irrational invited Pythagoras to join the group Han shot first
0 microseconds ago · Comment · Like

pythagoras image released under GNU Free Documentation License

Saturday, April 18, 2009

When are addition, subtraction, multiplication, division and exponentiation allowed?

Now that we've had a look at several groups of numbers let's bring together what operations are allowed for each one:

+-×÷ab
natural numbersyesonly larger number minus smaller or equal numberyesonly if it divides evenly; can't divide by zeroyes
integersyesyesyesonly if it divides evenly; can't divide by zeroonly positive and zero powers
rational numbersyesyesyescan't divide by zerointeger powers; some fractional powers
real numbersyesyesyescan't divide by zeronot allow some fractional powers of negative numbers e.q. (-1)(1/2)
complex numbersyesyesyescan't divide by zeroyes
The complex numbers are the only group that allows addition, subtraction, multiplication and exponentiation without restriction.

These increasingly larger groups of numbers can be seen as attempts to make subtraction, division and exponentiation work without restrictions.

The natural numbers allow exponentiation without restriction, but restrict subtraction and division. We can introduce negative numbers to allow subtraction (giving us the integers), but this forces restrictions on exponentiation.

We can then introduce fractions (giving us the rational numbers) to allow almost all divisions. Then adding irrational numbers (giving us the reals) allows fractional powers of all positive numbers and some powers of negative numbers.

To finally get back to having no restrictions on exponentiation, we need to include imaginary numbers leaving us with the complex numbers.

Beyond the complex numbers are the quaternions, octonians and sedenions.

+-×÷ab
complex numbersyesyesyescan't divide by zeroyes
quaternionsyesyesnot commutativecan't divide by zeroyes
octonionsyesyesnot commutative, not associativecan't divide by zeroyes
sedenionsyesyesnot commutative, not associative, not alternativecan't divide by zeroyes

Quaternions

The quaternions are an extension of the complex numbers. Instead of having just one square root of minus one: i, why not have 3: i, j and k?

We will need a way of multiplying them together. It turns out that the following works:

ij = k = -ji
jk = i = -kj
ki = j = -ki
ijk = -1

The quaternions are not commutative, which is quite strange. The order in which you multiply them matters! If you have two quaternions, x and y, then:

x × y = - y × x

Why have 3 square roots of -1 and not 2 square roots? Because with 2 the division doesn't work properly. Why not 4, 5, 6 roots etc? Well it works with 7 roots of -1. They are called the octonians. And with 15 roots you get the sedenions. The octonians are not commutative and not associative either. The sedenions are not commutative, associative or alternative.

The quaternions are given the symbol: ℍ

Complex Numbers

The complex numbers are the combination of the real numbers with the imaginary numbers. They are written as the real part plus the imaginary part. For example:

2 + 3i

The imaginary number i is defined as the square root of minus one, so i2 = -1. Multiplication of complex numbers follows the same rules as the real numbers, you just have to keep track of each part of the multiplication:

(2 + 3i) × ( 4 + 5i)
= 2 × 4 + 2 × 5i + 3i × 4 + 3i × 5i
= 8 + 10i + 12i - 15
= -7 + 22i

We can add, subtract, multiply and divide any two complex numbers and get a complex number* back (except dividing by zero). And, unlike the real numbers, we can raise any complex number to any other complex number without restriction.

For example:

32 = 9
3-2 = 1/9 = 0.11111111...
3(1/2) = √3 = 1.73205...
(-3)(1/2) = √(-3) = 1.73205i
32i = e2ln(3)i = cos(2ln(3)) + i sin(2ln(3)) = -0.5863 + 0.8101i
32+2i = 32 × 32i = 5.2763 + 7.2911i

The complex numbers are given the symbol: ℂ

-----

* the complex numbers include all real numbers. So 2 is the complex number 2 + 0i. Even though some complex multiplications give answers that are part of the real numbers, those answers are still complex numbers. For example (2 +3i) × (2 - 3i) = 13 (a real number) = 13 + 0i (a complex number).

Imaginary Numbers

The imaginary numbers are needed to fill in the last gap in exponentiation. The real numbers do not allow some negative numbers to be raised to fractional powers. For example they do not allow (-1)(1/2) = √(-1).

To get around this problem we can just make up an answer. We'll call this answer i. It can't be a real number, so it is outside the real numbers.

Using i allows us to find roots for all negative numbers. For example

√(-2) = √(2 × -1) = √2 × √(-1)= (√2)i = 1.414i

Both negative and positive numbers have two square roots. Just as both 42 and (-4)2 are 16, both (4i)2 and (-4i)2 are -16.

When we look at cube roots, thing get more complicated. Now every number has three cube roots, not just one, like it did with the real numbers. So not only does 33 equal 27, but so does (-3/2 + (3√3/2)i)3 and (-3/2 + (3√3/2)i)3

For more on this see the complex numbers.