Problem I
Outlaw Numbers
You are a witness to a shootout between outlaws from the notorious gang, the Atrebla Bandits! To avoid mayhem, members have agreed to follow a rather peculiar set of rules.
Each outlaw is assigned a number. The first outlaw in line is given a random positive integer $n$. After that, each outlaw’s number is set to the sum of the proper divisors of the previous one.
The shooting order is also specified, and members must shoot sequentially, starting with outlaw $n$. When an outlaw is shot, they are required to shoot the outlaw whose number is the sum of the proper divisors of their own. For example, when outlaw $10$ is shot, they must shoot outlaw $8$ ($1 + 2 + 5$). Don’t worry, the outlaws are experienced and will still be able to fire off a round before succumbing to their wounds.
A particularly smart outlaw has determined that every member will get shot, except perhaps the first person. He made sure to arrive extra early and is now first in line. However, there is still a chance that he will get shot if his number is equal to the sum over the proper divisors of some other outlaw. He still has time before it starts, can you help determine if he is safe?
It is worth noting that there are at most 32 members in the gang. If the process continues to 32 shots being fired and none of the sums are $n$, the first outlaw is safe, and the last outlaw won’t shoot anybody. To make it fairer, if an outlaw’s number is the sum of its own proper divisors, that outlaw is required to shoot himself in the name of sportsmanship. This includes the first outlaw who is assigned $n$.
Also note that the sum over the proper divisors of $0$ and $1$ are both defined to be $0$.
Input
The input is a single integer $2 \le n \le 10^8$, the starting outlaw’s assigned number. It is guaranteed that along with the given number $n$, every outlaw has a number $\le 10^8$.
Output
Simply output safe from harm if you can confirm that the first bandit is safe from being shot, or looking down a barrel otherwise.
Sample Input 1 | Sample Output 1 |
---|---|
25 |
safe from harm |
Sample Input 2 | Sample Output 2 |
---|---|
6 |
looking down a barrel |
Sample Input 3 | Sample Output 3 |
---|---|
14316 |
looking down a barrel |