challenges

my solutions to various "programming challenge" problems
git clone https://wehaveforgeathome.hates.computer/challenges.git
Log | Files | Refs | LICENSE

commit 7c25b37608cff31b5f5d017ddf268c67f3c6fee0
parent 560a86c995620860796a744a42411ca53e48f4c8
Author: Ryan Wolf <johnwayne@pseudony.ms>
Date:   Tue, 27 Apr 2021 22:35:23 -0400

golang soln for project euler 26

Diffstat:
Aprojecteuler/026/026.go | 26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/projecteuler/026/026.go b/projecteuler/026/026.go @@ -0,0 +1,26 @@ +package main + +import "fmt" + +func main() { + l := 0 + d := 2 + for i := 2; i < 1000; i++ { + cL := 0 + s := make(map[int]bool) + for j := 10; !s[j]; j = (j % i) * 10 { + if j == 0 { + // Doesn't repeat. + cL = 0 + break + } + cL++ + s[j] = true + } + if cL > l { + l = cL + d = i + } + } + fmt.Println(d) +}