A problem of Ulam about magnetic fields generated by knotted wires