Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. '''For Example, consider the given series: 1, 1, 2, 3, 4, 9, 8, 27, 16, 81, 32, 243, 64, 729, 128, 2187....
  2. This series is a mixture of 2 series – all the odd terms in this series form a geometric series and all the even terms form yet another geometric series.
  3. Write a program to find the Nth term in the series.'''
  4. n=int(input())
  5. if(n%2==0):
  6. n=n//2
  7. n=n-1
  8. print(3**n)
  9. else:
  10. n=n//2
  11. print(2**n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement