Floating over the integers

Perl 6, 28 characters

{grep({.Num+|0-$_},^∞)[^$_]}

Try it online!

This is actually 30 bytes, but the challenge is scored in characters.

This should work theoretically. This creates a lazy list of numbers that compares the default number type (with arbitrary precision) against the same number converted to a Num datatype, which is a 64-bit floating point number, and returns the first \$n\$ elements of the list

Here's a version starting at \$2^{53}-5\$


C (gcc), 58 bytes

f(n,i){for(i=9;n;i++)i-(int)(i+.0f)&&printf("%d ",i,n--);}

Try it online!

Works with 32-bit float.


JavaScript, 46 bytes

n=>{for(x=1n;n;)+[++x]!=x&&console.log(x)&n--}

This will certainly timeout on TIO. So, here is a TIO link which initialize x with 253.


  • Save 7 10 bytes, thanks to Neil.
  • Save 2 bytes, thanks to Arnauld