
Penguin Pablo has recently been really honing his programming skills, and is here to introduce a new series. He was going to call it the Plain Ol' Penguin Programming Puzzle (POPPP) series after an early Bay Area puzzle favorite, the POP series. But he decided to name it instead as a nod to his friends' Penguencoding series. His puzzle inspiration is varied, but he was recently seen struggling through another polar-themed puzzle event, the yearly Advent of Code challenge. Studying those is not at all required, but you might see some echoes of some of them here. Plus they're really fun and well thought out.
Unlike the Penguencoding series, there is no D1, as by the definition of geocaching difficulty rating, coding takes "special knowledge", and thus doesn't equate to the lowest difficulty. But the series should roughly start easier, and progressively get tougher. But fear not! Pablo is a generous sort, and is very free with hints - or at least after the FTF!
No particular language is required! This being Pablo's Plain ol' Penguin Programming Puzzle project, Perl and Python are clearly his favorite languages. But you can program in any language you want. Only the answer is needed. Typically once you've solved the puzzle the coordinates should be obvious, but perhaps you'll have to do a little lateral thinking to see them. You might even be savvy enough to use non-programming methods to solve the puzzles, especially the earlier ones.
This first one is a warm up, and gives you some cut and paste code that you can plug into an online execution environment. Snippets of Perl and Python are shown. Here is an online Perl execution environment, and here is one for Python. You can pop the code into either of those to get the example alive and running. This should produce a famous Italian sequence. Then minor modifications can be done to get the answer to the puzzle.
OK, first the code for Perl:
| my $MAX = 30; |
| my @seq = (0,1); |
| |
| for my $i (2..$MAX) { |
| push(@seq,$seq[$i-2]+$seq[$i-1]); |
| print "seq[$i] = $seq[$i]\n"; |
| } |
and for Python
| MAX = 30 |
| seq = [0,1] |
| |
| for i in range(2,MAX+1): |
| seq.append(seq[i-2]+seq[i-1]) |
| print("seq[" + str(i) + "] = " + str(seq[i])) |
OK, here's the puzzle:
- What happens if instead of [0,1], the sequence starts with [601,518]?
- How about [-222,563]?
You can validate your puzzle solution with
certitude.
Congratulations to first finder yoyo ken and first solver ddlatham!