Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
20
Task/Babbage-problem/Go/babbage-problem.go
Normal file
20
Task/Babbage-problem/Go/babbage-problem.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
const (
|
||||
target = 269696
|
||||
modulus = 1000000
|
||||
)
|
||||
for n := 1; ; n++ { // Repeat with n=1, n=2, n=3, ...
|
||||
square := n * n
|
||||
ending := square % modulus
|
||||
if ending == target {
|
||||
fmt.Println("The smallest number whose square ends with",
|
||||
target, "is", n,
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue