[Community Puzzle] The G Note - Puzzle discussion

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @pepper,validated by @kitarotao,@SlowSnakPierre and @SkyWhait.
If you have any issues, feel free to ping them.

Hello there,

Maybe it’s because I haven’t solved it yet (I just have a trivial solution that works only for low numbers for now), but I don’t see how it’s related to the Note G?

If it’s not a spoil of the solution, would someone care to explain how it is?
Thanks

Hi @Senua :slight_smile: Note G is a computer algorithm written by Ada Lovelace that was designed to calculate Bernoulli numbers using the hypothetical analytical engine. And it is related in some way with a task. However research is the most important part of this puzzle in my view, so try figure it out :wink:
Here you can find details: Wikipedia Note G

Although my solution passed all the tests, I feel it’s not the right one - it’s more of a hack. I’m waiting for someone to share the correct solution. So far, no one has posted it yet. :frowning:

Hello @Senua ,

I have solved this puzzle, and Note G did not help me at all.

Looking back at my code, it actually computes some values that are mentioned in the note, but only relies on:

  • recursion (as mentioned in the tags)
  • big integers (64-bits integers are not big enough for my approach)
  • three well-known formulas/algorithms on integers (things I have already used several times on CodinGame).

And I also use a hack at the end of my code. If the modulus were a prime number (as it usually is in this kind of puzzle), this hack would not be needed and the statement would be less misleading (I can’t help thinking about using double-precision floating-point numbers when I see 2^53).