Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!xanth!mcnc!ecsvax!dukeac!bet From: bet@dukeac.UUCP (Bennett Todd) Newsgroups: comp.lang.c Subject: Re: A self-referential challenge Message-ID: <1323@dukeac.UUCP> Date: 27 Mar 89 22:59:21 GMT References: <6219@bsu-cs.UUCP> Reply-To: bet@orion.mc.duke.edu Organization: Radiology, Duke Med. Center, Durham, NC Lines: 35 [ Asks for suggestions on how to make CRC-computer * >CRC-output contain correct CRC values for all files -- including "CRC-output" ] That's easy, just iterate looking for the fixed point, like so: touch .CRC-output finis=0 while test $finis -eq 0 do CRC-computer * >CRC-output diff CRC-output >/dev/null && finis=1 cp CRC-output .CRC-output done rm .CRC-output But please, not on my machine:-). Seriously, without an in-depth analysis of how CRCs behave (which is way, way beyond my abilities) there is no reason to believe that a fixed point exists; it might fall into a cycle instead (given any finite number of bits in the CRC, it has to do one or the other). Unless some mathematician steps forward and waves her magic wand, I expect the best answer will be to fall back 10 and punt: CRC-computer * | egrep -v CRC-output >CRC-output I really liked the question, though. -Bennett bet@orion.mc.duke.edu