When lockscreen hacks strike, maths can be the solution


18 Jul 2016

Bob is not loving that his phone has been hacked...

Whoever said we don’t need maths in real life has clearly never had to use it to combat a lockscreen hack.

Bob was wandering around town when he ran in to his friend, Alice.

“Did you get my text?” she asked him.

“I have no idea!” said Bob. “My phone has been hacked. Look.”

He handed the phone to Alice. The screen read:

Maths: lockscreen notification

“If I press ← or ≡, nothing seems to happen. If I press Δ, I get my usual home screen and the phone works fine, but sometimes my credit is docked by €1 or €2 and sometimes I’m not charged at all,” said Bob.

“There seems to be no pattern. It’s killing me. So I’m just using the phone for emergencies.”

Alice looked at the phone.

“I’ve heard about this,” she said. “The charge is set randomly – at €0, €1 or €2 – when the screensaver runs. You can’t see what its value is, but you can change it by pressing ← or ≡.

“Pressing ← cycles it ‘round from €0 to €1, from €1 to €2, and from €2 to €0. Pressing ≡ sets it back to €0, unless it’s already €0, in which case it becomes €2.”

Bob thought for a minute.

“So I could easily change the unlock charge to €0 if I knew what it was, but I can’t find out what it is?” he asked.

“Right,” Alice said.

“Is there a way around it?” asked Bob.

Alice gave it a little thought, then pulled out her notepad and drew a diagram:

Maths: lockscreen solution

“I’ve used A for ← and B for ≡,” explained Alice.

They both looked at the diagram for a while, until Alice finally exclaimed, “Yes! You can set the charge to €0 using the same four steps, no matter what the charge is to start with.”

What were Alice’s four steps?

Check back on Friday to see her solution.

This week’s maths puzzle comes courtesy of Prof Anthony G O’Farrell from Maynooth University, who is actively involved in the Irish Mathematical Olympiad and Mathematics Enrichment Classes at Maynooth.

Maths: Happy Bob

Bob is much happier now that he can use his phone again. Good for you, Bob. Image: Shutterstock

Solution:

The answer BAAB.

If Bob presses A, then the charge will move from €0 to €1, € to €2, or €2 to €0. This doesn’t help at all. But If he presses B, we know that the charge will move either to €2 or €0. So he presses B.

Now the charge is set to either €0 or €2. If he presses B again, the charge would move from €2 to €0, or vice versa. Again, this is unnecessary, as it would just bring Bob to the exact same position he was in already.

If he presses A, however, he will be on either €1 or €0. So he presses A.

Now the charge is set to either €0 or €1. If Bob presses B, he will return to €0 or €2 again, which is pointless. Pressing A, however, will change it to €1 or €2. So he presses A.

Now, if Bob presses B, he must end up back at €0. So he presses B.

Main image via Shutterstock