Live data from Hacker News

A list of practical projects that anyone can solve in any programming language

github.com

31–40 of 59 posts

Re: A list of practical projects that anyone can solve in any programming language

#32
post #16
post #12

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.

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 divides x or p divides y. Symbolic, this is p|xy => p|x OR p|y.

Indeed when we generalize the notion of "prime" from the integers to arbitrary rings, this "lemma" becomes part of the definition. In fact, even "irreducible" elements, which is a strictly weaker requirement than prime elements, excludes units (such as 1).

Re: A list of practical projects that anyone can solve in any programming language

#33
post #7

> Prime Factorization - Have the user enter a number and find all Prime Factors (if there are any) and display them. not to sound pedantic, but for any integer greater than 1 there is always at least one prime factor: https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithme... edit: for prime numbers, it is the number itself

Last time this happened I had to write a couple whole walls of text. There's more to this than you think! :)

https://news.ycombinator.com/item?id=14016396

Re: A list of practical projects that anyone can solve in any programming language

#37
post #9

My go-to for this sort of thing has always been Project Euler ( https://projecteuler.net/ ).

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 intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, however, that will not be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.

Just saying.

Re: A list of practical projects that anyone can solve in any programming language

#38
post #25

Earlier quoted context omitted.

Well, what constitutes a programming language then? It sounds like there is a clear definition :-) Coq is certainly a programming language, as you can build programs. But you can't interact with the subsystem, you can only build pure functions (Therefore it is quite hard to build a performance monitor). In my opinion English could also go as a programming language. Especially given the rise in NLP products. You can a…

"Well, what constitutes a programming language then? It sounds like there is a clear definition :-)" Some bloke called Turing had a few ideas on a definition. (I'll whisper "whoosh" here - for my own note) Given that any programming language can be defined in English (or any other human language, with a few contortions as required, if any) then of course English can be used to create a Turing Machine (TM). It doesn't…

I am not aware of his definition? I can't find it on google either. Can you point me to it?

A Turing machine does not talk about expressing computations, but rather a class of problems that can be computed.

Remember, not all programming languages are Turing complete (Coq being one of them).

Re: A list of practical projects that anyone can solve in any programming language

#39
post #30
post #2

Great list for inspiration! Though, it is not true that all the problems can be solved in any programming language: try to make a "Bandwidth Monitor" in Coq.

I think that looks like a framework for proving things about the bandwidth usage of other programs, no?

You are right :-)

But we could also consider another example: try to return the nth digit using a regular expression.

Re: A list of practical projects that anyone can solve in any programming language

#40
post #9

My go-to for this sort of thing has always been Project Euler ( https://projecteuler.net/ ).

There's also Project Rosalind: http://rosalind.info/problems/locations/

The problems are mostly bioinformatics related, which often boils down to string manipulation/comparison, graph theory

Post reply on HN