After finding out some cool patterns when toying with GHCi (I already forgot most of them -- hence the thread), I decided it would be a cool topic for everyone to share the little math related "discoveries" you find (i.e. cool patterns, functional relations, graphing cool stuff with an equation, neat tricks for solving complex problems, etc.) and post them here (and potentially have other people tell you who discovered them first and what the name of the "discovery" you made actually is)
I'll start, by a seemingly cool thing I found, which turns out to be just a regular pattern seen a lot in mathematics (difference of two squares).
I was playing around with functions in GHCi, and came up with this one:
Code:
I realized how when all arguments were natural numbers with digits composed only of 9's, and arguments a, b, and c are equal, it would return a natural number composed of only 9's with double the digit length as the parameters. So then to test it easier, I went to this:
Code:
(^ this is what I remember typing, may be slightly off, since I closed the window before I could copy down the working version. This should work however)
It seemed to show that for at least the first 100 natural numbers whose digits were composed of only 9s, this pattern showed to be true. This is when I realized it followed something more like the pattern of (x-1)(x+1)=x^2-1, in this case with {x|x x % 10 = 0}, since the result will always be a difference of two squares that produce a natural number composed of 9s (and therefore must be a power of ten decremented by one).
To tell a long story short, math is fun. The example above is really trivial and stupid, but I think is a good way to start off a thread like this. Share any find you have here; it makes math more interesting for all of us
I'll start, by a seemingly cool thing I found, which turns out to be just a regular pattern seen a lot in mathematics (difference of two squares).
I was playing around with functions in GHCi, and came up with this one:
Code:
f(a) -> f(b) -> f(c) = a^2 + b + c
I realized how when all arguments were natural numbers with digits composed only of 9's, and arguments a, b, and c are equal, it would return a natural number composed of only 9's with double the digit length as the parameters. So then to test it easier, I went to this:
Code:
pattern = pattern 9 1 []
pattern number index list = if index < 100
then pattern (number*10+digit) (index+1) (number^2+(2*number):list)
else list
where digit = 9
(^ this is what I remember typing, may be slightly off, since I closed the window before I could copy down the working version. This should work however)
It seemed to show that for at least the first 100 natural numbers whose digits were composed of only 9s, this pattern showed to be true. This is when I realized it followed something more like the pattern of (x-1)(x+1)=x^2-1, in this case with {x|x x % 10 = 0}, since the result will always be a difference of two squares that produce a natural number composed of 9s (and therefore must be a power of ten decremented by one).
To tell a long story short, math is fun. The example above is really trivial and stupid, but I think is a good way to start off a thread like this. Share any find you have here; it makes math more interesting for all of us