A party is being held at a local mansion, starting at 7pm. The host is very rich and his success is because of one thing — his famous recipe for spaghetti!
The only guests that may attend are people who correctly reply to the guard at the door.
You have a friend called Narmer, a former acquaintance of the host, who has talked you into trying to get into the mansion in order to steal the spaghetti recipe. The pair of you hide by the entrance to the mansion at 6pm and wait for the other guests to arrive.
The first guest arrives at 7pm. The guard says "4". The guest says "6". A gunman pops up from behind the wall and shoots the guest.
The second guest arrives at 7:15pm. The guard says "15". The guest says "8" and is admitted.
The third guest arrives. The guard says "14". The guest says "11" and is admitted.
The fourth guest arrives. The guard says "12". The guest says "6" and is admitted.
The fifth guest arrives. The guard says "21". The guest says "7" and is admitted.
"Can it really be that simple?" your friend murmurs to himself.
The sixth guest arrives. The guard says "9". The guest says "5". The gunman pops up again and shoots her too.
The seventh and eighth guests arrive together. They are talking to each other but you cannot understand what they are saying. The guard says "7" to one and "3" to the other. They answer "5" and "3" respectively; both are admitted.
"It is!" your friend exclaims. He breaks cover and saunters up to the entrance. The guard eyes him suspiciously and says "1". Your friend says "3" and is admitted.
The guard is now peering at your hiding place; he must have seen where your friend came from. You cannot stay here much longer. When the guard looks away for a moment, you emerge and walk up to him. He says "22".
First question: what number do you tell the guard?
Bonus question/hint 1: how does the guard decide what numbers to use as challenges? (There is a pattern to it!)
Where do Narmer and the host know each other from?
Edit after Michal's answer: none of the guests has a calculator with them; they all give their replies after only a few seconds' thought, without recourse to any electronic aid.