Advertisement
danchaofan

Euler #112

Dec 17th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. def bouncy(n):
  2.     n, increasing, decreasing = str(n), False, False
  3.     for x in range(len(n)-1):
  4.         if n[x] > n[x+1]:
  5.             increasing = True
  6.         if n[x] < n[x+1]:
  7.             decreasing = True
  8.         if increasing and decreasing:
  9.             return True
  10.     return False
  11.  
  12. total = 0
  13. for y in range(1, 10**100):
  14.     if bouncy(y):
  15.         total += 1
  16.     if total/y == 0.99:
  17.         print(y)
  18.         quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement