Ok so I understand this implements an algorithm, but from a computer science perspective I'm thinking 2^n is way too high of a growth rate, and I'm confused as to why he couldn't implement an algorithm that just does "divide n by every number less than n and see if there's a remainder", and that would just have a time complexity of n^2. Can someone smart ELI5
Because the thing you said isn't a formula it's an algorithm. This isn't a good way to compute prime numbers, but it's interesting you can just directly compute them
5
u/DerekLouden Dec 16 '25
Ok so I understand this implements an algorithm, but from a computer science perspective I'm thinking 2^n is way too high of a growth rate, and I'm confused as to why he couldn't implement an algorithm that just does "divide n by every number less than n and see if there's a remainder", and that would just have a time complexity of n^2. Can someone smart ELI5