Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. import sys
  2. sys.float_info.max
  3. print('yy = int(Y, 2)' )
  4. print('For a binary string equal to the input value in terms of length')
  5. print('Does this binary string (yy) has an exact factor for M?')
  6. print('I will show that the binary string is equal to creating tallies')
  7. value = int(input('Enter an integer >6: : '))
  8.  
  9. if value > 6:
  10.    print('ok')
  11. else:
  12.    print('must be > 6')
  13.    quit()  
  14.  
  15.  
  16. print('Tallies')
  17. ask = value
  18.  
  19. # Here asktally performs simple arthemtic in the geometric sequencing.
  20. # If you read the prior posts. You will the understand the purpose.
  21.  
  22. askTally = int(ask) -6
  23.  
  24. # Here the variable s adds the missing elements needed to create a binary
  25. # string that WILL always be equal to the input value.
  26.  
  27. s = "0" * askTally
  28. seq = ("11111","0");
  29.  
  30. # Here Y joins the two strings together s and seq and creates a binary string
  31.  
  32. Y= s.join( seq )
  33.  
  34. # The variable yy converts the binary string into int
  35.  
  36. yy = int(Y, 2)
  37. bitlength = len(Y)
  38. tally = str.replace(Y, "0", "1")
  39. print(tally, bitlength, 'Tallies')
  40. print(yy, '=', '124*','_',yy//124)
  41.  
  42.  
  43. n = yy
  44. m = int(input('enter target integer: '))
  45.  
  46.  
  47. if n % m == 0:  
  48.     print("yes,", m, "is a factor of", n)
  49. else:
  50.     print("no,", m, "is not a factor of", n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement