# Siteswap validator [closed]

Siteswap is a notation for juggling patterns.

The other siteswap puzzle is great and it explains siteswap in greater detail than here. This puzzle is meant to be a bit simpler! Numberphile recently interviewed Colin Wright which helped develop the notation. The part at ~16min will be useful for this challenge. Another resource which may be useful for wrapping your hear around siteswap if you have not used it before: In your head

Below is the diagram(courtesy of wikipedia) for valid throws with 3 balls and a max height of a throw of 5. A valid siteswap ends at the same position as it started.

A valid siteswap for the case we are interested in is defined as follows: In the diagram above choose a starting node and then follow the arrows and write down the number attached to the arrow. If you end up on the same node as you started then the number you have written down is a valid siteswap, otherwise it is not valid.

### Challenge

Take a number as input and output a truthy value if it is a valid siteswap for juggling with 3 balls with a max height of 5, otherwise output a falsy value. (No multiplex throws are allowed)

### Examples

Input             Output
------------------------
3                  True
3333333333         True
3342               True
441                True
5                  False
225225220          False
332                False

• I've voted to close this as unclear; challenges should provide all the required information rather than linking to other challenges and sites. As it stands, nothing in the challenge defines a valid siteswap nor can a definition be easily inferred from the test cases. In the future, please consider Sandboxing your challenges. Oct 12, 2017 at 12:05
• Possible duplicate? Certainly related. Oct 12, 2017 at 12:12
• @shaggy I hope my edit clarifies it; now the links serve more as additional background rather than primary explanation
lambda s:any(i==reduce(lambda C,c:int('40WW75W5AA47WW07W4WW54A0WWAA70A5WAA123896W'.replace('W','A'*3)[C::11][int(c)],16),s,i)for i in range(10))