Advertisement
bero_0401

Burnside’s lemma

Jul 13th, 2024 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | Source Code | 0 0
  1. # array with length n and m types
  2.  
  3. import math
  4.  
  5. def burnside_lemma(n, m):
  6.     total = 0
  7.     for k in range(n):
  8.         total += m ** math.gcd(k, n)
  9.     return total // n
  10.  
  11. # Test the function with the example given (n = 4, m = 3)
  12. n = 4
  13. m = 3
  14. result = burnside_lemma(n, m)
  15. result
  16.  
  17.  
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement