Write the longest possible loop.

Posted by Abhay on Stack Overflow See other posts from Stack Overflow or by Abhay
Published on 2010-12-23T20:38:35Z Indexed on 2010/12/23 20:54 UTC
Read the original article Hit count: 184

Hello Group,

Recently I was asked this question in a technical discussion. What is the longest possible loop that can be written in a programming language? This loop has to be as long as possible and yet not an infinite loop and should not end-up crashing the program (Recursion etc...)

I honestly did not know how to attack this problem, so I asked him if is it practically possible. He said using some computer science concepts, you can arrive at a hypothetical number which may not be practical but nevertheless it will still not be infinite.

Anyone here; knows how to analyse / attack this problem.

P.S. Choosing some highest limit for a type that can store the highest numerical value is apparently not an answer.

Thanks in advance,

© Stack Overflow or respective owner

Related posts about programming-languages

Related posts about loops