Hacker News new | past | comments | ask | show | jobs | submit login

There is a very interesting problem I’ve yet to crack (as per the sites guidelines, do not share solutions here, please): You have a triangle with equal sides. You shoot a laser at the minuscule opening at one corner, where it gets inside and bounces off the inner surface of the sides.

How many angles exist from which shooting the laser, it will bounce N times and exit through the same hole it entered from?

I have tried doing it in the naive way by writing a scala program that calculates reflections on the sides of the triangle and my idea was that iterating the degree in small quantities and plotting the distance of the Nth ray to the enter/exit corner would give me a visual way to count the angles we are looking for. The accuracy of doubles disallowed me from doing even the given N=11 example, so I made/reuse a rational number lib and I got the correct number for this sample. But the actual question wants N on the order of millions… I’m thinking that maybe some mathematical series could help, but haven’t tried cracking it since. But it was a great feeling writing even this easy version (I have even made a visual version with scala.js :D)




A wonderful problem. I must have spent over a year thinking about this on and off before arriving to the critical insight. The funny thing with some of these problems is that you get an amazing rush on the moment you solve a problem, but afterwards just feel kinda stupid for not seeing the solution much much earlier.

Years later, I was able to impress my colleagues by solving a similar problem someone posed over beers in an instant.

Have fun!


I've seen this puzzle before and not had any idea how I'd solve it.

I think everyone saying that a simple solution exists has just solved it for me!


This is a very beautiful geometric problem!

EDIT: removed hint.


This problem holds a special place in my heart.

When I first discovered PE* I checked the latest available problem, which was 202 that week. I remember thinking at the time that it was impossible to solve.

Fast forward a couple of years and a lot of solved PE problems. I took another go at 202 and I finally figured it out. The feeling of accomplishment I felt then...

*through an xkcd comic (https://xkcd.com/353/). The alt text mentions 20 small problems, which are problems from PE (IIRC this was specified in the now-defunct xkcd blog)


Good problem! Solution is very simple

Edit : REMOVED HINT


Problem #?





Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: