×

This is an archived post. You won't be able to vote or comment.

[–] 4 points5 points  (1 child)

[–] 0 points1 point  (0 children)

I looked into that, and started wondering how advanced a scenario one could make.

Something like

Mr P knows the area of the rectangle

Mr S knows the circumference

Mr H knows the length of the diagonal

Mr P says "I know that Mr D does not know whether Mr S knows that I don't know"

...and the others state that now they know.

[–] 0 points1 point  (0 children)

This is awesome.

The only thing that wasn't immediately clear in the fist part is what ariella0 does, as opposed to charlie0 which is easy to grok even without going to the 2nd part. Also Squarea is a weird name (I first parsed it as "square a"). But this is bikeshedding.

[–] 0 points1 point * (1 child)

For the curious, I (hello from my at work alt!) screwed up by assuming that the area would monotonically increase along with the perimeter.

A counterexample, (2,6,7) has a smaller area than (2,6,6) but a larger perimeter.

So, in `havingSquarea`, when I used `takeWhile (check (<= s + a^4))`, I assumed that as soon as I found a triangle (a,b,b) with squarea larger than s, that I could stop, when I should have realized that there still might be triangles (a,b,c) c > b, with squarea less or equal than s.

The fix for this would be to takeWhile either (a,b,b) has squarea lte s, or (a,b,b + a - 1) does. (I think. I haven't proved yet).

[–] 0 points1 point  (0 children)

I think you are right. Once you pick a and b, squarea is a fourth degree(?) function of c. There is a zero when c = a + b, but we want an actual triangle, so one candidate is c = a + b - 1. The next zero is c = b - a, but we restrict to c >= b, so the other candidate is c = b.

The first derivative of squarea with respect to c is (unless I made a mistake) s'_c = -4c(c2 - a2 - b2)

So the area is actually maximized when it's a right triangle!
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://www.reddit.com/r/haskell/comments/k8cpd/i_sorta_solved_ibms_puzzle_from_last_month_using/", "fetch_time": 1519426473000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2018-09/segments/1518891814857.77/warc/CC-MAIN-20180223213947-20180223233947-00246.warc.gz", "warc_record_offset": 918253062, "warc_record_length": 22173, "token_count": 550, "char_count": 1932, "score": 3.5, "int_score": 4, "crawl": "CC-MAIN-2018-09", "snapshot_type": "latest", "language": "en", "language_score": 0.9618750810623169, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00007-of-00064.parquet"}