# The Broken Device

Your old friend from college is visiting and brings back this weird electronic machine with him. He says that it's supposed to take input and spit out a number, but some prank was pulled on him (he was kind of a geek) where he, and the device, got dunked into the pool. It was turned on and your friend was electrocuted. Luckily he did survive (he did visit didn't he?) but during that shocking moment he forgot how his device worked, and the device was broken.

He came to you hoping you could help, he was hoping you could remember how it had worked. After you reply "no", he still wants help. He says you're the smartest person he knows.

Since it's broken the only information you have is a video you guys had took in college, and a weird note that had slowly been disappearing over the years.

In the video you guys were testing it. The few examples you could make out were:

$1863784 \rightarrow 1$
$1243242 \rightarrow 9$
$1742 \rightarrow 5$

The note seemed to be a set of instructions the computer followed:

Stp1
Sp2
rpatstputloetsnledgt
Sep3
rurnvle

Your friend was a terrible writer back then and his words were packed tightly together, therefore you couldn't distinguish any spaces. It was written in English.

Your friend needs your help to figure out how it works, and what the note says.

Just to clarify, you can do it in either order. Figuring out how it gets the number can be figured out easily by figuring out the note, or you could reverse the order and try to use the numbers to help figure out the note.

• Step 1: Add all her(mitian?) numbers maybe? step 2: Repeat step until ....? Nov 30, 2014 at 22:31

Step 1 says:

adalheumrs


Step 2 says:

rpatstputloetsnledgt


repeat step 1 until you get a single digit

Step 3 says:

rurnvle


return value

Basically, the machine keeps summing up the digits until you get a one-digit number, and returns that number. Like so:

$1863784 \rightarrow 37 \rightarrow 10 \rightarrow 1$
$1243242 \rightarrow 18 \rightarrow 9$
$1742 \rightarrow 16 \rightarrow 5$

• But then 1863784 should evaluate to 1, no? Am I doing it wrong? Nov 30, 2014 at 23:02
• Ooooops. I added the wrong numbers, it seems.
– user88
Nov 30, 2014 at 23:03
• Well it worked for the last two... perhaps the question writer made the same mistake I did?
– user88
Nov 30, 2014 at 23:03
• It's possible. I was thinking step 3 had to do something extra to make it right like "r[et]urn[ e]v[i]l[answ]e[r 2 if 1]." Nov 30, 2014 at 23:06
• It appears I did make a mistake. This is indeed correct. Dec 1, 2014 at 1:41

This is incomplete, but I'd like to know if I'm on the right track...

Step 1

Step 2

r[e]p[e]at[ ]st[e]p[ 1 ]u[n]t[i]l[ ]o[n]e[ ]t[????? ] s[i]n[g]le[ ]d[i]g[i]t

Step 3

Profit

• I believe you are.
– user88
Nov 30, 2014 at 22:55
• I might have screwed up. Step 1 should probably read "Collect underpants." Nov 30, 2014 at 22:56
• Nope, you were right about the first step.
– user88
Nov 30, 2014 at 23:01
• Was a South Park allusion, akshully. Nov 30, 2014 at 23:08
• You're on the right track. Dec 1, 2014 at 1:40