Advertisement
Spocoman

04. Sequence 2k+1

Sep 21st, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.19 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var n int
  7.     fmt.Scanln(&n)
  8.    
  9.     var k = 1
  10.  
  11.     for i:= 0; k <= n; i++ {
  12.         fmt.Println(k)
  13.         k = 2 * k + 1
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement