Python console.
Further to other answers, will elaborate on using the python console to test driver expressions
For a 1 every Nth frame, using modulus as elaborated on in other answers,
not frame % N
which is the equivalent of
frame % N == 0
Test run in the console, f for frame. A boolean when used in an expression is converted to an integer. 1 is True.
>>> for f in range(1, 10):
... f, f % 4, int(not f % 2), int(not f % 3), int(not f % 4)
...
(1, 1, 0, 0, 0)
(2, 2, 1, 0, 0)
(3, 3, 0, 1, 0)
(4, 0, 1, 0, 1)
(5, 1, 0, 0, 0)
(6, 2, 1, 1, 0)
(7, 3, 0, 0, 0)
(8, 0, 1, 0, 1)
(9, 1, 0, 1, 0)
replace N with a number for your driver expression, eg every 4th
not frame % 4
Note this can be typed directly into the property field. Prefix the expression with hash # the first time eg #not frame % 4 to signify it as a driver (turns purple on entering).
Since these are booleans, every 4th or every 13th
not frame % 4 or not frame % 13
For a repeating pattern 000011 it may be simpler to shift the frame to make frame 1 calculate as 0
>>> for f in range(1, 10):
... f, (f - 1) % 6, int((f - 1) % 6 > 3)
...
(1, 0, 0)
(2, 1, 0)
(3, 2, 0)
(4, 3, 0)
(5, 4, 1)
(6, 5, 1)
(7, 0, 0)
(8, 1, 0)
(9, 2, 0)
Expression
(frame - 1) % 6 > 3
which is the same as
(frame - 1) % 6 // 4
using mods partner in crime to integer divide modulus result by 4. Only 4 and 5 will produce 1.