This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generalized_josephus(self, x): | |
# express x as a radix d number-sequence | |
rad_d = Radix.tuple(x, base=self.d) | |
# then apply the generalized josephus transformation to convert to a radix c number-sequence | |
rad_c = [self.alpha_vector[rad_d[0]-1]] | |
for dig in rad_d[1:]: | |
rad_c.append(self.beta_vector[dig]) | |
# convert rad_c to a number and return |
NewerOlder