Guest User

Untitled

a guest
Dec 14th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. func main() {
  8. num := 540561
  9. recipes := []int{3, 7}
  10. one, two := 0, 1
  11. for len(recipes)-10 < num+1 {
  12. //fmt.Println(one, two)
  13. //fmt.Println(recipes)
  14. comb := recipes[one] + recipes[two]
  15. if comb < 10 {
  16. recipes = append(recipes, comb)
  17. } else {
  18. recipes = append(recipes, comb/10, comb%10)
  19. }
  20.  
  21. one = (one + recipes[one] + 1) % len(recipes)
  22. two = (two + recipes[two] + 1) % len(recipes)
  23. }
  24. for _, v := range recipes[num : num+10] {
  25. fmt.Print(v)
  26. }
  27. fmt.Println()
  28. }
Add Comment
Please, Sign In to add comment