Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- )
- func main() {
- num := 540561
- recipes := []int{3, 7}
- one, two := 0, 1
- for len(recipes)-10 < num+1 {
- //fmt.Println(one, two)
- //fmt.Println(recipes)
- comb := recipes[one] + recipes[two]
- if comb < 10 {
- recipes = append(recipes, comb)
- } else {
- recipes = append(recipes, comb/10, comb%10)
- }
- one = (one + recipes[one] + 1) % len(recipes)
- two = (two + recipes[two] + 1) % len(recipes)
- }
- for _, v := range recipes[num : num+10] {
- fmt.Print(v)
- }
- fmt.Println()
- }
Add Comment
Please, Sign In to add comment