Right, sorry, in python that&#x27;s something like:<p><pre><code>  from itertools import chain, repeat

  chain.from_iterable([repeat(i % 2 != 0, i) for i in range(1,1000)])
</code></pre>
In Java 8, I think the solution with streams would be fairly straightforward, something like:<p><pre><code>  IntStream.range(1,1001).flatMap(i -&gt; Stream&lt;Boolean&gt;.generate( () -&gt; (x &amp; 1) != 0 ).limit(i))</code></pre>