简体   繁体   中英

How long would it take or is it possible to calculate permutations in python given a 6 digit number?

I'm attempting to compute the number of possible permutations of pixels in an hdmi display which I know to be discrete and finite, however I'm having trouble conceptualizing the big-O notation and/or processing power needed. I have the following function that works for 4 digit numbers:

def permutations(num):
 var = num
 for i in range(num):
  var *= 3
 return var

I need to apply this function to a number 2073600, however my python interpreter stops. Is there a way this can be easily done or the function adapted to use concurency?

The best possible solution would be to lose some accuracy and treat the number passed into the function as rounded number and then append 0's into the string to represent the actual number, or use scientific notation and a floating point. Using a floating point could have other implications under different implementations on different processors, however using a rounded integer would work any any that supported the number of digits you rounded to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM