Print out all IPv6 addresses

Python 3, 65 bytes · 0.8 = 52.0

from ipaddress import*
n=4**64
while n:n-=1;print(IPv6Address(n))

Pyth, 27 25 24 bytes

Note: the code had a bug previously, fixing it saved 1 byte

J^4 64WJj\:c%"%032x"=tJ4

Prints the addresses like

ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe
ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffd
ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffc
...
0000:0000:0000:0000:0000:0000:0000:0003
0000:0000:0000:0000:0000:0000:0000:0002
0000:0000:0000:0000:0000:0000:0000:0001
0000:0000:0000:0000:0000:0000:0000:0000

Previous (more complicated) version using the pad operator (also 24 bytes):

J^4 64WJj\:c.[\032.H=tJ4

Explanation

J^4 64                  set J to 2^128
WJ                     while J is not 0:
            =tJ               decrement J
    %"%032x"                 format to length-32 hex string
   c           4            split every 4 chars
j\:                        join by : and print

Pyth, 21 bytes (invalid)

jmj\:c.[\032.Hd4^4 64

This can't be run since 1) it would consume at least 2132 bytes (252 yobibytes) of memory and 2) the interpreter doesn't like it (2128 doesn't fit in ssize_t, so no lists of that size). It would print the addresses in lexicographical order. You can try out the algorithm by changing the number(s) in the end to something usable.


C (with GCC extensions), 76 bytes * 0.8 = 60.8

__uint128_t i;main(){char s[50];for(;inet_ntop(10,&i,s,49),puts(s),++i>0;);}

This uses the 128-bit integers GCC extension to simply count up from :: to ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff. inet_ntop() correctly formats each address so the -20% bonus can be claimed.

Output

Using sed to output every millionth line up to 10 million:

$ ./ipv6all | sed -n '1~1000000p;10000000q'
::
4042:f00::
8084:1e00::
c0c6:2d00::
9:3d00::
404b:4c00::
808d:5b00::
c0cf:6a00::
12:7a00::
4054:8900::
$ 

Note I am using a little-endian x86_64 machine, and that network addresses are typically always in network-order (big-endian), so the endianness is effectively swapped by using inet_ntop(). This does not matter - all addresses will still (eventually) be displayed.