News for hackers. Stuff that matters.
Re:Printing 1 to 1000 without loop or conditionals by spicyj on Monday January 03, 2011 @03:15AM (#2062565)
Doesn't that involve just as much looping as any other solution?
Re:Printing 1 to 1000 without loop or conditionals by mfukar on Monday January 03, 2011 @09:19AM (#2063178)
See, the trick is that while you don't approve, some others do.
Re:Printing 1 to 1000 without loop or conditionals by Dylan16807 on Tuesday January 04, 2011 @07:16AM (#2066671)
They would? I don't follow. A random number generator only gives you one number at a time. The problem is still 'print X sequence without loops'. No answer has been given here, so there's no meaningful approval to be had.

It's not that using a random number generator is a cheat, it's that it is a (pointless?) lateral move rather than a solution.

Re:Printing 1 to 1000 without loop or conditionals by chc on Wednesday January 05, 2011 @01:59PM (#2071995)
You print the first 1000 terms. No loop was mentioned.

That's the cheat. You don't approve. Others might.

Re:Printing 1 to 1000 without loop or conditionals by Dylan16807 on Sunday January 09, 2011 @12:21PM (#2085814)
How do you print multiple terms out of a random number generator without a loop? That's my point. You haven't solved anything, cheat or not.
Re:Printing 1 to 1000 without loop or conditionals by mfukar on Monday January 10, 2011 @03:27AM (#2087882)
Recursion, compile-time code generation, templates, dispatching.

Pick whatever you like most.