DEV Community

Discussion on: Advent of Code 2019 Solution Megathread - Day 22: Slam Shuffle

Collapse
 
jbristow profile image
Jon Bristow

I take no shame in reading a few lisp solutions to spoil my answer. With every year, I find a new way of looking at data that uncovers new possible "cheats".

Just like my favorite solution to the sum of squares problem (the sum of the squares from 1 to n): m * (m + 1) * (2*m + 1) / 6

Collapse
 
coolshaurya profile image
Shaurya

Didn't know about this equation. Also you may have accidentally written m instead of n in the formula :) .

Thread Thread
 
jbristow profile image
Jon Bristow

Whoops! The notes I have it in mark it as ‘partial sum(n2) for 1 to m = ...` (copied from wolfram alpha)