Sunday Times Teaser 3135 – Rhythmic Gymnastics
by Colin Vout
Published Sunday October 23 2022 (link)
Skaredahora used three rhythmic patterns of quaver beats in a short, purely percussive, composition. His “Dotykam” rhythm has accents on beats 1, 4, 6, 7, 8, 10 & 11; “Kluc” has accents on beats 1, 8 and one particular beat in between; and “Omacka” has accents on beats 1, 2, 5, 6 & 10. Several percussion instruments are involved, each playing one of the three rhythms, but starting at different times. Overall the patterns overlap, with every beat in the composition being filled by an accent from exactly one of the instruments, and all the patterns finishing by the end of the composition.
What is the other beat of Kluc, and what is the order of appearance of the rhythmic patterns (eg DOOKD)?
-
Brian Gladman permalink1234567891011121314151617181920212223242526272829303132# the three sequences of accented beats (D, K, O)bps = [[1, 4, 6, 7, 8, 10, 11], [1, 0, 8], [1, 2, 5, 6, 10]]# add a drum (and its first beat position in the composition) to <drums># and update the set of accented beats in <beats> while generating any# drum sequences that give a complete set of contiguous accented beatsdef add_drums(drums=(), beats=set()):# are all beats accented?if beats and len(beats) == max(beats):yield drums, len(beats)else:# find the current lowest non-accented beatp = min(set(range(1, max(beats | {1}) + 1)) - beats)# select a drum to add with its first beat at this pointfor nd in range(3):# add the new accented beats ...nb = set(b + p - 1 for b in bps[nd])# ... provided that none clash with those already placedif not (nb & beats):# add the drum and continue to the next drumyield from add_drums(drums + ((nd, p),), beats | nb)# consider the position of the unknown accent in Kfor kx in range(2, 8):bps[1][1] = kx# find complete contiguous beat compositionsfor drums, n_beats in add_drums():dr = ''.join('DKO'[i] for i, p in drums)bp = ', '.join(str(p) for i, p in drums)print(f"K's accent {kx}; drums {dr}; {n_beats} beats [drums @ {bp}].")
-
John Z permalink123456789101112131415161718192021222324252627282930313233343536373839404142def bqalc(f, s =''):# are all beat positions filled?if bin(f).count('0') == 1:yield selse:#find position of first 0 in 'f'f0 = bin(f)[2:].index('0')# consider next patternfor i, np in enumerate(Beats):# align first '1' in np with first '0' of f# by shifting complete score or next pattern leftwardsif ((sh := len(bin(np)) - len(bin(f)) + f0) > 0 andf << sh & np == 0 # no coinciding beatsor sh <= 0 andf & np << (-sh) == 0):# place next pattern in the complete score; proceed to next levelyield from bqalc(f << sh | np if sh > 0 elsef | np << -sh, s + 'DKO'[i])# 123456789teDm = 0b10010111011 # Dotykam bit mask (1, 4, 6, 7, 8, 10, 11)# 12345678Km = 0b10000001 # Kluc bit mask + one other (1, 8)# 123456789tOm = 0b1100110001 #Omacka bit mask (1, 2, 5, 6, 10)# consider position of other beat in Klucfor k in range(2, 8):b = 1 << (8 - k)Beats = (Dm, Km | b, Om)for q in bqalc(0):print(k,q)