Robbers thread
In this thread, your task is to find a non-recursive solution which produces the same integer series of a submission not marked as 'safe' in the Cops' thread.
Challenge synopsis
In many languages, recursive functions can significantly simplify a programming task. However, the syntax overhead for a proper recursion may limits its usability in code-golf.
The cops will create a program or function taking a single integer n
, which will generate the first n
entries of an integer series, using only recursion.1.
The robbers will try to find a shorter program or function in the same language, generating the same integer series, using no recursion2.
If the cops' submission is not cracked within ten days (240 hours), the cop will prove it was in fact possible to have a shorter non-recursive approach by revealing their own solution. They may then mark their submission as safe.
The winner of the cops challenge will be the shortest (according to code-golf) recursion-based submission marked safe.
The winner of the robbers challenge will be the robber who cracked the most solutions.
1: It only needs to be recursive in syntax; you don't need to worry about for example tail call optimization.
2: Again, non-recursive in syntax; so you can't post a recursive solution and claim its compiled to a loop thanks to tail call optimization.
Requirements
Each submission will take a single integer n
(zero- or one-based). The submission will then output or return the first n
entries of the same integer series as the cops' entry. The input and output method may differ between the recursive and non-recursive approach.
Your robbers' entry must be strictly shorter in byte-count than the recursive solution. It must work for at least the same n
, or up to n=2^15-1
, whichever is smaller.
Recursion
For the sake of this challenge, recursion is defined as creating the desired sequence using a function (or function-like construct) that calls itself (or calls a sequence of functions that ends up calling itself). The recursion depth should go to infinity as n
goes to infinity. The non-recursive approach is anything that is not recursive.