[0]: https://sites.google.com/site/prologsite/prolog-problems
[1]: http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/func...
[2]: https://wiki.haskell.org/99_questions
[3]: https://wiki.python.org/moin/ProblemSets/99%20Prolog%20Probl...
41–50 of 59 posts
[0]: https://sites.google.com/site/prologsite/prolog-problems
[1]: http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/func...
[2]: https://wiki.haskell.org/99_questions
[3]: https://wiki.python.org/moin/ProblemSets/99%20Prolog%20Probl...
Earlier quoted context omitted.
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.
The 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 di…
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.
Earlier quoted context omitted.
True, and when talking about "numbers" one would generally include 3/7 and maybe e , negative numbers and perhaps complex numbers... or at the very least negative integers...
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.
Any other lists of projects like this?
Any other lists of projects like this?
They contain a surprising amount of basic computer science in very short questions. Master them and you'll be well on your way to understanding functional (or declarative, in the case of Prolog) programming.
My go-to for this sort of thing has always been Project Euler ( https://projecteuler.net/ ).
Although I agree with another poster that Euler is a bit math heavy, being able to submit a single number to check your solution is handy. Google's foobar recruiting puzzle system actually tests your program, but it's limited to Python and Java.
I really like Rosetta Code esque projects. Rosetta Code has been somewhat abandoned as of late recently though.
Earlier quoted context omitted.
I've posted this several times, but... https://github.com/seaneshbaugh/rosetta-euler It's an ongoing thing I work on when I'm not working on anything in particular.
I'd like to mention that Project Euler states that they'd prefer that people not publish the solutions publicly: > I learned so much solving problem XXX so is it okay to publish my solution elsewhere? It appears that you have answered your own question. There is nothing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intention…
My go-to for this sort of thing has always been Project Euler ( https://projecteuler.net/ ).
Project Euler has good problems, but they are heavy on the math and that does require some domain knowledge. I'd be more happy with a book that has 50 fairly simple apps to build in a simple language like Python where the apps aren't a whole lot longer than tic-tac-toe (~1/2 page).