The program on the next slide aims to find the first 10 prime numbers and print them. However, there is a bug in the program and it does not work.

Identify the bug in the program and fix it.

You are at a magical lake guarded by three mystical creatures: a dragon, a mermaid, and a unicorn. Each creature always tells the truth or always lies. The dragon says, “The mermaid always lies.” The mermaid says, “The unicorn always tells the truth.” The unicorn says, “I am the only one here who tells the truth.” If only one creature tells the truth, which creature is it?

You have a four-minute hourglass and a seven-minute hourglass. How do you measure nine minutes?

Four people need to cross a bridge at night and it’s too dark to cross without a flashlight. Only one flashlight is available. The bridge can support only two people at a time. Each person takes a different amount of time to cross: 1 min, 2 min, 7 min, and 10 min. What is the shortest possible time for all four people to cross the bridge? 

A room in an old house contains 3 light bulbs, each connected to 1 of 3 switches outside the room. The door to the room is closed. You can operate the switches freely, but you can only open the door once, and you can’t change the switches after opening it. All bulbs work. Identify which switch controls each bulb.
 

A circular birthday cake has to be divided into 8 equal pieces within 3 cuts. How can you do it? 
 

You have $15. You go to a chocolate shop and find that the price per chocolate is $1. The shopkeeper tells you that you can also get a chocolate in exchange for 3 wrappers. What is the maximum number of chocolates that you can get?
 

You stand before two doors: one leads to heaven, the other to hell. Two guards stand watch; one always tells the truth, the other always lies, but you don’t know who is who. You can ask one question to one guard to find the door to heaven. What do you ask?