Consider a grid of 1 9 × 1 9 LED's which Initially are OFF. You are allowed to select an array of 5 × 5 LED's and toggle their states. After toggling the 2 2 5 different 5 × 5 arrays one after one, how many LED's will be turned O N ?
This problem is original.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
A general mathematical formula for any given L × W grid taking n × m arrays
Number of O N LEDs = L × W − ( ⌊ 2 n ⌋ × 2 × W + ⌊ 2 m ⌋ × 2 × L ) + ⌊ 2 n ⌋ × ⌊ 2 m ⌋ × 4
Problem Loading...
Note Loading...
Set Loading...
The following table gives the number of times an LED is toggled. If this number is even, then the LED will of OFF at the end, but if the number is odd, then the LED will be ON.
1 2 3 4 5 5 5 ⋮ 5 5 5 4 3 2 1 2 4 6 8 1 0 1 0 1 0 ⋮ 1 0 1 0 1 0 8 6 4 2 3 6 9 1 2 1 5 1 5 1 5 ⋮ 1 5 1 5 1 5 1 2 9 6 3 4 8 1 2 1 6 2 0 2 0 2 0 ⋮ 2 0 2 0 2 0 1 6 1 2 8 4 5 1 0 1 5 2 0 2 5 2 5 2 5 ⋮ 2 5 2 5 2 5 2 0 1 5 1 0 5 5 1 0 1 5 2 0 2 5 2 5 2 5 ⋮ 2 5 2 5 2 5 2 0 1 5 1 0 5 5 1 0 1 5 2 0 2 5 2 5 2 5 ⋮ 2 5 2 5 2 5 2 0 1 5 1 0 5 ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋱ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ 5 1 0 1 5 2 0 2 5 2 5 2 5 ⋮ 2 5 2 5 2 5 2 0 1 5 1 0 5 5 1 0 1 5 2 0 2 5 2 5 2 5 ⋮ 2 5 2 5 2 5 2 0 1 5 1 0 5 5 1 0 1 5 2 0 2 5 2 5 2 5 ⋮ 2 5 2 5 2 5 2 0 1 5 1 0 5 4 8 1 2 1 6 2 0 2 0 2 0 ⋮ 2 0 2 0 2 0 1 6 1 2 8 4 3 6 9 1 2 1 5 1 5 1 5 ⋮ 1 5 1 5 1 5 1 2 9 6 3 2 4 6 8 1 0 1 0 1 0 ⋮ 1 0 1 0 1 0 8 6 4 2 1 2 3 4 5 5 5 ⋮ 5 5 5 4 3 2 1
In the table, we see that there are 9 odd numbers in each of the 5 × 5 -corner squares. Additionally, in the 5 × 9 -edge rectangles, there are 3 ⋅ 9 = 2 7 odd numbers each. In the central 9 × 9 -square, all 81 numbers are 25, so also odd.
Therefore, there are a total of
4 ⋅ 9 + 4 ⋅ 2 7 + 8 1 = 2 2 5
LEDs that will be on.
How I got the table:
If we enumerate the LEDs such that the top left ist ( 1 , 1 ) and the bottom right is ( 1 9 , 1 9 ) , then the numbers in the top left quarter of the table are given by
a ( x , y ) = min ( x , 5 ) ⋅ min ( y , 5 ) .
This is because for a particular LED ( x , y ) there is a toggling square for each LED that is to the top and left of this LED, but no further than 5 spots away.
A more complicated formula can also give the number for all LEDs
a ( x , y ) = min ( 5 , 1 0 − ∣ x − 1 0 ∣ ) ⋅ min ( 5 , 1 0 − ∣ x − 1 0 ∣ )