From 19fefa765818f33e4ca18819cb1a6266679f727f Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Fri, 25 Dec 2020 08:01:23 +0100 Subject: [PATCH] Day 25: dummy open-coding --- 49.pl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 49.pl diff --git a/49.pl b/49.pl new file mode 100755 index 0000000..eeeead3 --- /dev/null +++ b/49.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl -w + +use strict; + +my ($val1, $val2) = (1, 1); +my $iter = 0; +my $subj1 = 7; +my $subj2 = 7; +my ($pub1, $pub2) = @ARGV; + +while (++$iter) { + $val1 *= $subj1; + $val2 *= $subj2; + $val1 %= 20201227; + $val2 %= 20201227; + if ($val1 == $pub1) { + print "$iter loops for subj1\n"; + $val1 = $pub2; + for (2 .. $iter) { + $val1 *= $pub2; + $val1 %= 20201227; + } + print "key=$val1\n"; + } + if ($val2 == $pub2) { + print "$iter loops for subj2\n"; + $val2 = $pub1; + for (2 .. $iter) { + $val2 *= $pub1; + $val2 %= 20201227; + } + print "key=$val2\n"; + } +} + -- 2.43.5