News for hackers. Stuff that matters.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @09:43AM (#28233727)
(a) The test is the wrong way round for the Collatz Conjecture;

(b) The Collatz Conjecture isn't one of the Millennium problems;

(c) It's using bounded numbers in the range where the Collatz Conjecture is known to be true;

(d) It seems reasonable to say "If this routine exits then the value will be "true";

(e) None of what I say here is deep or new, so when people get excited about this sort of thing it makes me wonder what I've missed.

So ... what have I missed?

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by stephencanon on Thursday August 19, 2021 @10:01AM (#28233921)
(a) part of the joke

(b) the Millennium problems are not the only million-dollar prizes in mathematics

(c) part of the joke

(d) part of the joke (and part of the C++ standard)

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @10:30AM (#28234273)
(b) There are other prizes, but I'm not aware of any others worth a million dollars. Do you have any pointers? A quick interwebs search didn't turn up anything, but they might just be being swamped by the results with the Millennium Problems.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by tpush on Thursday August 19, 2021 @10:40AM (#28234394)
> A quick interwebs search didn't turn up anything [...]

Searching 'collatz conjecture prize' quite literally puts a prize of a bout 120MM Yen (~ $1MM) as the top result.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @10:57AM (#28234656)
Hah! I didn't search specifically for that, I was searching for bounties in general.

Thanks.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ithinkso on Thursday August 19, 2021 @11:04AM (#28234746)
There is also a Beal Conjecture[0] worth a million

[0] https://en.wikipedia.org/wiki/Beal_conjecture

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @11:08AM (#28234795)
My initial search for bounties didn't turn up that one, either. I wonder if my connection(s) with Erdos have polluted my search history, so it was showing me mostly those, and not showing me this.

<shrug>

Thanks for finding this and letting me know, I've learned something.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by lostcolony on Thursday August 19, 2021 @09:45AM (#28233747)
The joke.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by cabaalis on Thursday August 19, 2021 @10:05AM (#28233980)
I've only seen Veretasium YouTube video on this a few days ago, and I'm not a mathematician. Is the joke that LLVM has solved the mystery by optimizing out what it decided is an infinite loop?
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by WJW on Thursday August 19, 2021 @10:17AM (#28234128)
LLVM optimizes out the infinite loop, because the C++ standard defines that all programs must be able to make forward progress and so removing this loop does not alter the result of the program. Thus, collatz() as written in the tweet will always return true when optimized by LLVM. This says nothing about the conjecture being true or not, it is solely an artifact of the C++ standard being written a certain way.

But also a layer deeper, collatz() takes a uint128 as input and the Collatz conjecture has already been proven to be true for all numbers that would fit into a uint128. So LLVM arrives to the correct answer (`return true`) because of the wrong reason, mathematically speaking.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ludocode on Thursday August 19, 2021 @11:13AM (#28234880)
This doesn't exactly follow the Collatz conjecture because multiplication by 3 will be truncated to a 128-bit unsigned int. It is possible that this truncation causes a loop. Even though the Collatz conjecture has been tested for all numbers in this range, it has probably not been tested with this overflow effect.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by plasticchris on Thursday August 19, 2021 @11:33AM (#28235153)
Edit: removing my comment, I misunderstood.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by WJW on Thursday August 19, 2021 @11:40AM (#28235247)
Not so, since the fact that it is in the range does not mean it will steadily go downwards. It might have numbers much bigger than the maximum value for a uint128 somewhere in its Collatz sequence and it is possible (though unlikely) that one of those numbers modulo the maximum value for a uint128 is the original number again. (That is, the modulo operation might introduce loops that are not present in the normal Collatz sequence because mathematical integers don't overflow)
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by Thiez on Thursday August 19, 2021 @10:17AM (#28234127)
The C++ standard allows compilers to assume that loops terminate. Since there is only one way to exit the loop (`return true;`) the compiler can assume that this line will eventually be reached. Since the rest of the loop has no side effects, the compiler can optimize it out.

So the compiler doesn't actually need to figure out if the loop is infinite or not.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by Denvercoder9 on Thursday August 19, 2021 @10:59AM (#28234674)
> The C++ standard allows compilers to assume that loops terminate.

Technically, it doesn't, but it requires programs to make forward progress, which is defined as either terminating, calling I/O functions, accessing a volatile variable or performing an atomic or synchronization operation. Infinite loops that'll eventually do one of these are perfectly valid C++ and don't have to terminate.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by HelloNurse on Thursday August 19, 2021 @11:31AM (#28235134)
It optimizes "waste an unpredictable time doing arithmetic without side effects, then return 1" to "return 1 without looking at the input". The relation between that machine arithmetic and the Collatz conjecture is irrelevant.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by Denvercoder9 on Thursday August 19, 2021 @11:57AM (#28235468)
I don't think you're responding to the right comment?
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by junon on Thursday August 19, 2021 @10:09AM (#28234026)
Yes.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by cies on Thursday August 19, 2021 @10:05AM (#28233975)
Savage. I dont often laugh loud reading HN. Today I did. Thanks.
[dead]
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by lostcolony on Thursday August 19, 2021 @10:47AM (#28234490)
Oh, I understand your points. But I see the joke sailed right over your head; I'm guessing you didn't realize that this joke is presented as a joke, notably due to the phrase "pack it in mathematicians", since it's quite unreasonable to believe that anyone familiar with the Collatz Conjecture would believe that solving it is the only reason for mathematicians to exist (and also quite unreasonable for anyone familiar enough with LLVM and mathematics to assume a compiler's behavior constitutes a mathematical proof).

I can't speak to online forums (I use them for so many things), but I'm sure Twitter is the right place for humor, and not the right place to announce a serious belief you've proved a long standing mathematical problem.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @11:03AM (#28234723)
> "Oh, I understand your points. But I see the joke sailed right over your head ..."

OK, I guess my sense of humour hasn't translated into your context. Clearly my comment makes you think I didn't get the joke, but I did.

> "I'm guessing you didn't realize that this joke is presented as a joke, ..."

Oh, I did. Really, I did.

I guess we're just talking past each other. <shrug> You didn't get my joke, probably because you think I didn't get the original.

Time to give up.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by lostcolony on Thursday August 19, 2021 @11:10AM (#28234833)
Okay. I'm not sure dissecting the technical inaccuracies of a joke ("but an imam would never walk into a bar!") is itself a joke (and I'm pretty sure you edited the comment just above to agree it was a joke, but maybe I just didn't read it closely enough), especially when you'd give the exact same response if you didn't know it was a joke, but did know it was technically incorrect, but fair enough.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @11:19AM (#28234970)
I didn't edit any comments, though I can appreciate that a quick skim might leave you with a different impression, and returning might lead you to believe I must have edited it. But I didn't.

I really do think we've just been talking past each other. When something is as obviously "tongue-in-cheek" as the original post, I find it funny when people (a) get the joke, then (b) play it with a completely straight bat. It appears that doesn't cross cultural boundaries in the way I thought it would.

You're not alone ... some of my comments are getting significant numbers of downvotes.

<shrug> ... "Humour".

I'll go back to appearing humourless and commenting purely technically on purely technical things. Meanwhile ... nice to connect with you ... thanks for the responses.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by lostcolony on Thursday August 19, 2021 @11:29AM (#28235108)
Fair enough. I'll say, it helps to indicate you're not being serious in that situation; that's hard in text, but something like a "well akshually" (as a deprecating reference to https://knowyourmeme.com/memes/ackchyually-actually-guy) preceding it would help.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @12:07PM (#28235602)
That's all true, but putting "humour warnings" kinds defeats the purpose, and converts what would be dry humour into something more akin to slapstick, a bit like that person we all know who always insists on going "Bah-doom, Tsh!" on every mildly funny aside. When someone else highlights things that that I no longer find them funny at all, so I'd be reluctant to do it.

I appreciate the feedback ... I think the best thing for me is just not to try again, and to be explicit when I know something is a joke, and clear that I'm adding factual information.

Watching people continue to downvote the comments I've made, HN is clearly the wrong place for me to do otherwise.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by alisonkisk on Thursday August 19, 2021 @12:12PM (#28235655)
When people intentionally miscommunicate (even in jest), misunderstanding is a foreseeable side effect.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by tantalor on Thursday August 19, 2021 @09:48AM (#28233778)
> The test is the wrong way round

Specifically, Collatz says "if x is even then x /= 2" but the code checks "x is odd".

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by rtkwe on Thursday August 19, 2021 @10:30AM (#28234268)
> (b) The Collatz Conjecture isn't one of the Millennium problems;

It's not but there are more bounties out there than just the Millenium list. For the Collatz Conjecture specifically there's a 120M Japanese Yen prize which at this moment is a bit more than 1 million USD.

https://www.prnewswire.com/news-releases/bakuage-offers-priz...

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by ColinWright on Thursday August 19, 2021 @11:05AM (#28234759)
(Also commented elsewhere) ... I didn't search specifically for that, I was searching for bounties in general.

Thanks.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by yissp on Thursday August 19, 2021 @11:02AM (#28234717)
> (c) It's using bounded numbers in the range where the Collatz Conjecture is known to be true;

The input is an unsigned __int128, and I believe Collatz has only been verified up to 2^68.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by jens-c on Thursday August 19, 2021 @05:16PM (#28239481)
Not to mention that the answer by itself is pretty much worthless, but Mathematicians are rather interested in a proof of the conjecture (or its negation).

I get that it is supposed to be a joke, but it kind of falls flat because it misses the point entirely.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by gameswithgo on Thursday August 19, 2021 @10:38AM (#28234369)
You have no sense of humor or curiosity about compiler optimization details that led to this, I guess.

For instance not all languages that target LLVM will get this result. That is interesting.