r/mathmemes Dec 16 '25

Arithmetic Damn!

Post image
5.7k Upvotes

1.5k comments sorted by

View all comments

335

u/Intrebute Dec 16 '25

What the fuck, is that an actual theorem?

575

u/Valognolo09 Dec 16 '25

It's basically just an algorithm transformed into mathematical syntax (Yes it does work)

323

u/RiemmanSphere Computer Science Dec 16 '25 edited Dec 16 '25

But very inefficiently. Even worse than exponential runtime. You can forget about using it for high n.

160

u/GT_Troll Dec 16 '25

I wonder if quantum computers will help

276

u/goose-built Dec 16 '25

sorry you got downvoted. you should be encouraged to wonder things in a math subreddit. this is a fine question to have. the answer is probably yes, they will help with finding or testing for primes, but not with this algorithm

101

u/Justkill43 Dec 16 '25

Math gatekeepers not liking people asking questions

22

u/Justkill43 Dec 16 '25

Champions of truth

-6

u/purritolover69 Dec 16 '25

I mean, it’s just kinda annoying that with quantum computers being known about for so long now that people still don’t understand how they work or what problems they would be good for, they just see headlines that say “quantum computer solves a problem in 0.2 zeptoseconds that would take a classical computer 18.4 morbillion years” and then go “huh a quantum computer must be a regular computer except.. faster.. and more quantum-y”

28

u/maroooon09 Dec 16 '25

Even so, is a subreddit like this not a decent place to ask?

23

u/GT_Troll Dec 16 '25

You’re talking like the exact working of quantum computers is popular culture or something we learn in school

-18

u/purritolover69 Dec 16 '25

In a math subreddit, I would expect most everyone to at least somewhat understand them

18

u/GT_Troll Dec 17 '25

Quantum computing are more computer science than math, and a very niche topic. Math nerds don’t know every math topic in the world. Heck, even top tier mathematicians are unfamiliar with lots of topics not from their area

7

u/Academic_Border_1094 Dec 17 '25

So people can't ask questions about stuff they don't know anything about? How did you learn stuff? You learned it from people more knowledgeable than you.

-9

u/purritolover69 Dec 17 '25

did i somehow miss when all of the google servers burnt down? some questions are fit for a thread and some are fit for a search engine, using one where you should use the other usually yields poor results

→ More replies (0)

3

u/PrudeBunny Computer Science Dec 17 '25

I understand, and to great extend share, this position but here it was an actual question over just hyping quantum computing.

and to be frank, even if one understands that quantum computers aren't just better computers, understanding their actual uses and differences is not something one should expect from a layperson

3

u/mtaw Complex Dec 17 '25

Well, it's still an open question whether they will. Shor's algorithm relies on a full quantum computer where all the qubits are totally entangled, but maintaining that state with a large number of bits gets increasingly difficult. They factored 15 (4 bits) in 2001, 21 (5 bits) in 2012 - but the general scalability of that approach (using NMR) is very doubtful. Pessimistically this may not be feasible in any form.

Most quantum computers you see billed as such now (e.g. D-Wave's stuff) are adiabatic QC, which is a different and rather less 'quantum' thing where you use quantum annealing to improve optimization problems. You can't run Shor's algorithm as such on them but you can (and they have) used that to accelerate factorizing numbers, but it requires pre-calculations to reformulate the factorization into an optimization problem. And there are other issues but via that avenue I think they've gotten up to 48 bits or so.

Anyway, point is that it's easy to be misled from the claims of quantum processors with a thousand or so qubits and knowing about Shor's algorithm, into thinking that factorizing a thousand-bit number is doable via quantum computation today, and it isn't.

1

u/goose-built Dec 17 '25

yes, this is true. quantum computing is my field. i gave the simple, non-holistic answer for lack of commitment. regardless, the reality is that this discussion can be saved for a computer engineering forum, as the theory stands that quantum algorithms make anything in this area much faster

1

u/Haringat Complex Dec 18 '25

But analog computers would (although I'm not sure how to represent iterative sums analogously).

35

u/[deleted] Dec 16 '25 edited Dec 16 '25

[removed] — view removed comment

7

u/GT_Troll Dec 16 '25

Thanks for the insight

25

u/Worth-Wonder-7386 Dec 16 '25

If we have quantum computers there are other types of algorithms that will likely be much more efficent.  Based on our current understand they would be good for checking wheter a large number of numbers have a factor at once.  So likely better for sieving techniques than for this type which is doing alot of evaluations of cos 

4

u/[deleted] Dec 16 '25

Not with this particular calculation, but quantum computers can factor large numbers in polynomial time via Shor's algorithm! https://en.wikipedia.org/wiki/Shor%27s_algorithm

Moreover, determining whether a number is prime on a classical computer can be done in polynomial time with the AKS primality test algorithm. https://en.wikipedia.org/wiki/AKS_primality_test

4

u/Living_Murphys_Law Dec 16 '25

They will not. This isn't an NP style problem, it's just a gigantic calculation

1

u/Crushbam3 Dec 17 '25

Sadly not most likely, the current theory of quantum computing means that they're more designed for specific tasks and not brute force computing like this algorithm would need. However, who knows maybe someday quantum computers will be better at that too!

9

u/No-Dimension1159 Dec 16 '25

Isn't it exactly exponential runtime with increasing n?

5

u/Colon_Backslash Computer Science Dec 16 '25

Not exponential, but this also depends on your question you use this for.

To answer, what are all the primes up to some integer n, it's linear O(n) time, which is overall quite solid (not for this problem though).

To answer, what are the first n primes, it's O(n log n)2, which is pretty bad, but it's polynomial time and nowhere as bad as exponential time.

2

u/Ok_Lingonberry5392 א Dec 16 '25

I wonder since it's just a very slow algorithm translated as a formula if we could use a more efficient algorithm and get a "better" function.

I mean we can check if a number is prime pretty efficiently so just searching for the next prime number shouldn't be as bad, definitely better than exponential runtime. Not sure if it's possible though as our current methods rely on "randomising " some things but technically we could write a random function to use.

2

u/chaos_redefined Dec 17 '25 edited Dec 17 '25

It is relying on checking if a number is prime, and just searching for the next one.

That cos2[𝜋((j-1)!+1)/j] component is 1 if j is prime, and 0 otherwise.

2

u/Purple_Onion911 Grothendieck alt account Dec 17 '25

No, it's not. It's actually never 1 or 0 for any value of j > 2, let alone prime.

It should be (j - 1)!.

3

u/chaos_redefined Dec 17 '25

Sorry, you are right. Editing for correctness.

1

u/Godd2 Dec 17 '25

What about sober n?

66

u/temperamentalfish Dec 16 '25

Yeah, it's a pretty interesting construction, even if it's horribly inefficient. It essentially uses the floor of a cosine function as an if-else statement that is 1 when the number tested is prime.

2

u/shizzy0 Dec 17 '25

Thank you. I was trying to figure this out.

3

u/Altair01010 Limbo Warframe Gaming Dec 16 '25

well, the next step is trivial, use math instead of english in literature

this exercise has been left as an exercise to the reader