# 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? – eye_am_groot Nov 14 '18 at 11:57
• Because the first triple "121" does not contain all 3 digits. – Ben Franks Nov 14 '18 at 11:58
• Should 132321 be rejected as 323 does not contain 1? – Omega Krypton Nov 14 '18 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" – Ben Franks Nov 14 '18 at 12:03
• Then why is 123321 rejected? thanks! – Omega Krypton Nov 14 '18 at 12:06

## 2 Answers

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. – beemaad Nov 15 '18 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. – Evan Capstick Nov 15 '18 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. :) – beemaad Nov 15 '18 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 – Evan Capstick Nov 15 '18 at 12:48

# Answer

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. – Paul Palmpje Nov 14 '18 at 16:03
• @PaulPalmpje Then you would have a repeating set of 2s, for example 1322..., which is rejected by definition of the puzzle. – beemaad Nov 14 '18 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. – Paul Palmpje Nov 14 '18 at 16:10
• Can you see a way to optimise this more. – Ben Franks Nov 15 '18 at 0:17
• Wouldn't an empty input be valid too? In that case the start node should also be red. – Kruga Nov 16 '18 at 8:42