The final day! Of course it hase to be public-key cryptography…

Part 1

Well the first part is pretty straightforward, just implement the algorithm described to find the secret key (a.k.a. the number of loops):

transform(n, subj) = (n*subj)%20201227

function loops(key, subject=7)
    n = subject
    i = 1
    while n != key
        n = transform(n, subject)
        i += 1
    end
    return i
end

And then to calculate the encryption key:

function encrypt(key, loops)
    n = 1
    for i in 1:loops
        n = transform(n, key)
    end
    return n
end

Part 2

Merry Christmas and Happy New Year!

Now I just need to finish days 19, 20, 22, and 23

/Posts
/Photos
#adventofcode (25)
#apl (5)
#baking (3)
#biggreenegg (9)
#bike (1)
#chia (5)
#data-visualization (8)
#development (48)
#devops (4)
#docker (1)
#electronics (7)
#elixir (1)
#engineering (9)
#food (13)
#golang (1)
#home-improvement (3)
#julia (19)
#keto (1)
#keyboards (4)
#lisp (8)
#meta (1)
#monitoring (10)
#photos (13)
#races (2)
#racket (1)
#recipes (6)
#run (2)
#rust (1)
#swim (1)
#woodworking (12)