# Input/Output Problem #4

See here for basic rules on problem.

Input/Output Problem #1

Problem #4

Make an optimal machine that accepts sequences of digits 1-3 that contain a 1,2,3 in each triple of numbers and has no repeating number. E.g accepts 123123, 132321 but rejects 121323, 123321.

• Why is 121323 rejected? Commented Nov 14, 2018 at 11:57
• Because the first triple "121" does not contain all 3 digits. Commented Nov 14, 2018 at 11:58
• Should 132321 be rejected as 323 does not contain 1? Commented Nov 14, 2018 at 12:01
• Hmm I think it wasn't worded well by me but by triple I mean first 3 numbers then next three numbers following that. Therefore 1st triple is "132" and 2nd triple is "321" Commented Nov 14, 2018 at 12:03
• Then why is 123321 rejected? thanks! Commented Nov 14, 2018 at 12:06

It seems that the solutions being considered optimal are the ones with the fewest numbers of nodes.

Solution using only 8 nodes below (Thrown together quickly on paint, sorry):

• This machine allows for 123321 which is rejected by definition of the puzzle.
– user53694
Commented Nov 15, 2018 at 9:47
• Huhn, I just realized it says it rejects 123321 in the examples, but seems to have absolutely no reason as to why it should (And I got answer checkmark), I'll ask OP. Commented Nov 15, 2018 at 12:09
• It says it should have "no repeating number". It looks to me like OP is not in the possession of the right solution. :)
– user53694
Commented Nov 15, 2018 at 12:12
• Yeah, I assumed it just meant no number repeats within a triple, with no absolutely no regard from one triple to another Commented Nov 15, 2018 at 12:48

Optimized I/O machine

# Non-optimized version

I think this should work for the I/O machine

• I think this needs an additional arrow with 2 from the middle red dot straight left. Commented Nov 14, 2018 at 16:03
• @PaulPalmpje Then you would have a repeating set of 2s, for example 1322..., which is rejected by definition of the puzzle.
– user53694
Commented Nov 14, 2018 at 16:06
• Don't think so. What happens if you're in the middle red dot state and a 2 appears? That is not valid anymore? You're at the end of a triplet so any new valid triplet should lead you to a new end state. What happens if the first new value is a 2? It should go to the same location as a startin ginput of 2. Wait sorry, I overlooked the repeating digit constraint. Commented Nov 14, 2018 at 16:10
• Can you see a way to optimise this more. Commented Nov 15, 2018 at 0:17
• Wouldn't an empty input be valid too? In that case the start node should also be red. Commented Nov 16, 2018 at 8:42