Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 6th, 2020 323 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '''
  2. have a holder
  3. have a n to count the values whose cube is within bounds
  4. while loop to itterate through
  5. keep adding cubes till number is reached if number is excat as m return n else return -1
  6. while loop so base case of 1
  7. '''
  8. import math
  9. def find_nb(m):
  10.     holder = 1
  11.     n = 2
  12.     if m == 1 ** 3:
  13.         return 1
  14.     else:
  15.         while(holder < m):
  16.             holder = holder + (n ** 3)
  17.             if holder == m:
  18.                 print(holder)
  19.                 return n
  20.             else:
  21.                 n += 1
  22.         return -1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top