Counting from 1 to an Integer… in Binary
APL, 10 characters
Another on in APL. Assumes⎕IO←1
(the default). No bonus points. Reads the number from the input device. If your APL uses 64 bit integers instead of 32 bit integers, substitute 64 for 32 as needed.
Notice that APL transparently converts to floating point numbers when the range of an integer is exceeded. It's hard thus to exactly say what integer size APL works with.
⍉(32⍴2)⊤⍳⎕
explanation
2 ⍝ the number 2
32⍴2 ⍝ a vector of 32 twos.
(32⍴2)⊤X ⍝ X represented as base 2 to 32 digits precision
⍳X ⍝ a vector of the integers from 1 to X
⎕ ⍝ a number queried from the terminal
(32⍴2)⊤⍳⎕ ⍝ the output we want, flipped by 90°
⍉(32⍴2)⊤⍳⎕ ⍝ the output we want in correct orientation (⍉ is transpose)
JavaScript (ES6) 56.8 (71*0.8)
32 bit version, as JavaScript can not handle 64 bit precision (at most 53 bits using floating point doubles)
Without grouping
f=n=>{for(i=0;i++<n;)console.log((8*(8<<26)+i).toString(2).slice(1),i)}
With grouping - score 60.16 (94*.64)
f=n=>{for(i=0;i++<n;)console.log((8*(8<<26)+i).toString(2).slice(1).match(/..../g).join` `,i)}
Test in any browser (ES5)
function f(n)
{
for(i=0;i++<n;)console.log((8*(8<<26)+i).toString(2).substr(1).match(/..../g).join(' '),i)
}
// Test
console.log = function(x,y) { O.innerHTML += x+' '+y+'\n' }
Count to: <input id=I><button onclick="O.innerHTML='';f(+I.value)">-></button>
<pre id=O></pre>
Pyth, 18 * 0.8 * 0.8 = 11.52 bytes
VSQjd+c.[64.BN\04N
Example output:
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 1
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 2
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0011 3
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0100 4
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0101 5
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0110 6
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0111 7
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1000 8
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1001 9
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1010 10