AI summary by TwinMind
Can you solve the computer virus riddle? - James Tanton
TED-Ed
5m 54s
Problem Setup
- Antivirus squad faces malicious code hijacking mainframe
- Malware corrupts 1 of 4 disks (represented by on/off lights)
- Malware selects agent, reveals corrupted disk, allows single switch flip, then de-rezzes agent
- Squad must destroy correct corrupted disk or entire system gets erased
- Lights only visible inside mainframe
- Challenge: communicate corrupted disk identity with single action
Binary Representation Solution
- Each of 4 disks represented by 2-bit binary number (00, 01, 10, 11)
- Need mathematical operation: lit disks as input → corrupted disk as output
- Initial approach: sum lit disks to indicate corrupted disk number
Addition Strategy Development
- Example 1: corrupted disk 11, no lights on → turn 11 on
- Example 2: corrupted disk 11, already on → turn 00 on (00 + 11 = 11)
- Problem case: corrupted disk 00, disks 01 and 10 on
- Sum = 11, need to change to 00 with one flip
- Standard options don't work
- Turning 11 on gives 110 (three digits)
- Solution: treat result as 22, regard 2s as 0s
Parity-Based Solution
- Modified binary addition: regard 2s as 0s
- Strategy: sum all lighted disks, treating 2s as 0s
- If sum already correct → flip 00
- If not → find switch that makes sum correct
- Any starting configuration can sum to any number 00-11 with single switch flip
Parity Concept Explanation
- Parity = whether value is even or odd
- Applied to number of 1s in each digit place of binary sums
- 2 and 0 both even → treated as equivalents
- Adding/subtracting 00, 01, 10, or 11 changes parity of either, both, or neither digit
Scalability
- Solution works for any mainframe with power-of-2 disks
- 64 disks: 6-bit binary numbers, sum 1s in each column
- Even sums = 0, odd sums = 1
- 1,048,576 disks theoretically possible but daunting
Resolution
- Agent makes sacrifice using parity solution
- Team successfully destroys corrupted disk
- System freed from malware
