22
\$\begingroup\$

This is a different type of compression challenge. In a normal challenge, you are required to recreate a list exactly. Here, you are allowed to round the values in any way you wish. What's the catch? Your score is penalized based on how wrong your output is.

At the bottom of this question is a list of the first ionization energies for the first 108 elements. Your program, upon execution, should output a reasonably accurate copy of this list. There will be no input or arguments. For scoring purposes your output should be deterministic (same output every time).

Output format

Your program/function must output a list of 108 numbers, sorted in order of increasing atomic number. This list can be in any appropriate format. The source data below is provided in the correct order, from hydrogen to hassium.

Scoring

Your score will be your program's length in bytes plus a rounding penalty. A rounding penalty is calculated for each element and summed to give the total penalty.

As an example, let's take the number 11.81381. Let's say that your program outputs an incorrect value of 11.81299999.

  1. First, both numbers are multiplied by the same power of 10 such that there is no longer a decimal point in the true value: 1181381, 1181299.999. Trailing zeros in the true value are considered significant.

  2. Then, the absolute difference is taken to determine the absolute error: 81.001.

  3. Finally, we calculate this element's penalty as max(0, log10(err * 4 - 1)) -> 2.50921. This formula was chosen such that an error < 0.5 gives no penalty (since the answer is correct within rounding), while also giving an asymptotic 50% chance that rounding the number to any particular decimal place would provide a net benefit in score (assuming no other compression).

Here is a Try-It-Online implementation of a penalty-calculating program. The input to this program is provided as a list of numbers, one per line. The output of this program is the total penalty and a per-element breakdown of scoring.

Data

The list of numbers below is the target data, in the correct order from atomic number 1 to 108.

Source

13.598434005136
24.587387936
5.391714761
9.322699
8.2980190
11.260296
14.53413
13.618054
17.42282
21.564540
5.1390767
7.646235
5.985768
8.151683
10.486686
10.36001
12.96763
15.7596112
4.34066354
6.11315520
6.56149
6.82812
6.746187
6.76651
7.434018
7.9024678
7.88101
7.639877
7.726380
9.3941990
5.9993018
7.899435
9.7886
9.752392
11.81381
13.9996049
4.177128
5.69486720
6.21726
6.63390
6.75885
7.09243
7.11938
7.36050
7.45890
8.33686
7.576234
8.993822
5.7863552
7.343917
8.608389
9.00966
10.45126
12.1298431
3.893905548
5.211664
5.5769
5.5386
5.473
5.5250
5.582
5.64371
5.670385
6.14980
5.8638
5.93905
6.0215
6.1077
6.18431
6.254159
5.425871
6.825069
7.549571
7.86403
7.83352
8.43823
8.96702
8.95883
9.225553
10.437504
6.1082871
7.4166796
7.285516
8.414
9.31751
10.7485
4.0727409
5.278424
5.380226
6.3067
5.89
6.19405
6.2655
6.0258
5.9738
5.9914
6.1978
6.2817
6.3676
6.50
6.58
6.65
4.90
6.01
6.8
7.8
7.7
7.6

Baselines & Tips

The source data above is 906 bytes, with certain compression tools able to get it to sub-500 bytes. Interesting solutions are those that attempt to perform intelligent rounding, use algebraic formulas, or other techniques to output approximate values in fewer bytes than compression alone. It is difficult, however, to judge these tradeoffs across languages: for some languages compression alone might be optimal, while many other languages might lack compression tools altogether, so I expect a wide variation in score across languages. This is fine, as I'm going by the "competition within languages, not between them" philosophy.

I anticipate that it might be useful to attempt to take advantage of trends in the periodic table. Below is a graph I found of ionization energies, so that you can see some of these trends.

enter image description here

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Hm, the graph shows some interesting trends, maybe that's helpful for compression... \$\endgroup\$ Commented Feb 7, 2018 at 17:50
  • 3
    \$\begingroup\$ Side note: this is a pretty experimental challenge. The scoring scheme is unique, I hope it works out well. \$\endgroup\$
    – PhiNotPi
    Commented Feb 7, 2018 at 18:14
  • \$\begingroup\$ Very nice challenge. Unfortunately, the accuracy of the reference is so high that physically motivated approximation formulas (which can't really expect to predict more than two digits) have hardly a chance to compete against literal compression of the digits. (Short of actually solving the Schrödinger equation of course, which isn't very feasible either.) It would IMO be more interesting without the logarithm in the penalty formula, so that high-significant digits are actually more important to get right. \$\endgroup\$ Commented Feb 8, 2018 at 13:30
  • \$\begingroup\$ @PhiNotPi The scoring scheme isn't that unique, right? \$\endgroup\$ Commented Feb 9, 2018 at 5:32
  • 1
    \$\begingroup\$ @EsolangingFruit Yeah I see the similarities. I think this is unique in that the penalty is "continuous" meaning that you're not simply right or wrong for any particular output, so it's about finding how much you should fudge each number. (This scoring scheme was much more unique back in 2015 when I first sandboxed it, lol.) \$\endgroup\$
    – PhiNotPi
    Commented Feb 9, 2018 at 6:38

10 Answers 10

6
\$\begingroup\$

Clean, 540 bytes + 64.396 Penalty = 604.396

Note: for the sake of readability, I've escaped every byte in the [Char] literal as most of them are non-printable. However, they are counted as only one byte per escape (except the null, quote, and newlines) as Clean naturally takes source files encoding-independently (except nulls).

import StdEnv,GenLib
c[h:t]=[(toInt h>>i)rem 2\\i<-[0..7]]++c t
c[]=[]
r[]=[]
r l=[7<<29+2^62+sum[d<<p\\d<-l&p<-[32..53]]:r(drop 22l)]
u::Maybe[Real]
u=uncompress{e\\e<-[108:r(c['\145\062\353\227\045\336\021\131\341\224\212\225\230\140\121\241\231\027\321\306\361\254\075\154\161\041\144\255\346\110\371\126\172\155\361\127\152\023\350\222\117\116\341\222\155\357\351\072\341\153\315\025\171\317\141\367\076\232\377\323\206\301\257\235\103\154\157\274\035\010\347\167\142\370\355\074\172\320\347\036\165\262\210\364\177\025\144\176\303\223\143\116\340\270\012\172\062\377\257\141\265\320\342\261\225\347\215\165\044\152\017\011\133\251\027\347\243\307\231\304\165\351\325\035\036\053\010\341\344\131\363\207\072\045\327\012\130\347\167\023\312\023\210\013\347\244\236\020\172\153\362\370\142\123\276\116\226\341\211\245\105\136\145\146\130\367\123\026\312\244\225\347\152\225\145\142\207\164\227\145\360\105\140\201\041\271\141\273\274\230\020\101\166\101\133\171\063\155\302\062\036\061\335\147\130\365\175\201\203\035\357\341\272\172\270\067\047\002\200\223\342\156\230\253\152\347\105\322\335\117\203\220\242\342\316\137\311\247\004\155\164\124\131\205\325\203\116\306\365\170\325\032\143\337\017\331\232\006\266\122\176\305\334\137\214\312\130\035\110\306\206\227\001\000\150\353\121\132\146\246\226\231\071\365\050\140\063\063\333\314\314\307\314\354\231\231\171'])]}

Try it online!

This is the first challenge where I've been able to utilize Clean's generic compression ability (technically not actually compression, it's binary serialization) to gain an actual benefit.

I started with a [Real] - a list of 64-bit floating-point numbers, those from the question. After serializing this list, I simplified the top 10 bits (which were the same for each number), and the optimal configuration of the bottom 32 bits into the constant 7<<29+2^62. The remaining 22 bits per number were translated into 2.75 characters each, and encoded in a string.

This leaves the entire compressed constant at only 302 bytes, including every escape!

\$\endgroup\$
1
5
\$\begingroup\$

Python 3, 355 + 202 353 bytes + 198 penalty = 551

for i in'趐￵㠡愍噢甹靍跄땠㖀侙㹐哜洫毙蛿ꐏⴰ㾤䑎䜕䘻䙱䵤剄刋侈偯懌㹴刼旧斆竼醽⭼㭉䂹䔏䙜䧕䨝䲠䶦囊仟嶡㰽䱴妝巋泍繆⢉㙁㨎㦨㣺㦄㨜㫀㬈䀅㴋㷔㺯㾕䁡䄛㡼䜍亘凞册埘嵙嵃怊沨㾗䴵䯘垗惿濥⩦㛳㠂䆧㵑䁻䄺㺻㸰㹟䂅䅥䉊䎫䒀䔺㌃㺑䛊儳倩伞':print(ord(i)/2665)

Try it online!

I used 0xffff (65535) as upper bound because it's the max value that can be stored in a single 3-bytes unicode character.
Since the highest ionization energy is ~24.587, that gives a ratio of 2665.
To generate the string itself I used the snippet ''.join([chr(int(round(n*2665)))for n in ionization_energies]) (on python2 you need to use unichr), your console may or may not be able to print the characters.


4-bytes characters, 462 bytes + 99 penalty = 561

for i in'򖛬􏿸𻩕񧈞񛳀񼤓򠲊򖩥󀯗󮣬𸶞񔥢񂍻񚋙񴀥񲦹򏝅򮕴𰁌񃨇񈥢񋢔񊨓񊶬񒏒񗚽񗋰񔡂񕞒񧻆񂗠񗘳񬒕񫸬򂬋򚷮𮍚𾿾񄱴񉘳񊱑񎝜񎰡񑛏񒠺񜎠񓳾񣟨񀀯񑏠񟎯񣪶񳧟򆋻𫄹𹩷𽬜𽑕𼢹𽇭𽰄𾛰𾮨񄂄񀷥񁬶񂧎񃤐񄚟񅋼𼁡񋠊񓡆񖿯񖪈񝖑񣌪񣆷񦃬񳝰񃤫񒃁񐦉񝅇񧄳񶹼𭃠𺙈𻡍񅱉񁊈񄡙񅓾񂪑񂅝񂑺񄤃񅟜񆜑񇺀񈲩񉤍𶍍񂟅񋎚񖒚񕋦񔄳':print(ord(i)/45312)

Try it online!
Same idea, but the max value is 0x110000

\$\endgroup\$
3
  • \$\begingroup\$ Why can a single three byte unicode character only store 0x100**2 values and not 0x100**3? \$\endgroup\$ Commented Feb 8, 2018 at 14:29
  • \$\begingroup\$ I would say that the currently known highest atomic number is 118 -- in this case the highest to consider is 108 --, not ~24. You probably meant ionization energy in eV. \$\endgroup\$ Commented Feb 8, 2018 at 14:33
  • \$\begingroup\$ @JonathanFrech has a point: UTF-8 is a bad choice here. Other encodings are more efficient. \$\endgroup\$
    – Dennis
    Commented Feb 8, 2018 at 15:21
4
\$\begingroup\$

C, 49 bytes + 626.048 penalty = 675.048

f(i){for(i=0;i<108;)printf("%f\n",5.5+i++/13%2);}

Try it online!

\$\endgroup\$
4
  • 5
    \$\begingroup\$ 37 bytes: f(i){for(i=0;i++<108;)printf("6\n");} ; penalty: 625.173330827107 ; total = 662,173330827 \$\endgroup\$
    – Tsathoggua
    Commented Feb 8, 2018 at 7:45
  • 1
    \$\begingroup\$ @Tsathoggua Hmm, I thought I tried that and got a higher penalty. I guess I was wrong. f(i){for(i=0;i<108;)puts("6");} does the same thing in 31 bytes. \$\endgroup\$
    – Steadybox
    Commented Feb 8, 2018 at 15:12
  • \$\begingroup\$ You need the i++ too (in the "31"), but f(i){for(i=108;i;i--)puts("6");} does 32. \$\endgroup\$ Commented Feb 8, 2018 at 22:49
  • 2
    \$\begingroup\$ @JonathanAllan Whoops. f(i){for(i=108;i--;)puts("6");} gets it back down to 31. \$\endgroup\$
    – Steadybox
    Commented Feb 8, 2018 at 22:56
4
\$\begingroup\$

CJam (389 bytes + 33.09 penalty => 422.09)

xxd-encoded:

0000000: 2256 3232 7c24 1bf9 7116 2f43 c82b 110e  "V22|$..q./C.+..
0000010: 6b93 4525 1cb3 4118 4afc 4d05 5c22 e15a  k.E%..A.J.M.\".Z
0000020: 11bc 563c 38e4 626c 1efb 6b10 c229 0e35  ..V<8.bl..k..).5
0000030: 873d 15df 2f71 36ca 404d 54d9 4979 17ba  .=../[email protected]..
0000040: 4938 a953 6fb6 5f04 75f0 5c22 5c6b 39e5  I8.So._.u.\"\k9.
0000050: 3073 6fbd 343e fb36 4fff 357c 8c36 10f3  0so.4>.6O.5|.6..
0000060: 3b3c 37cd 3f1c 10a1 3f06 933d 0f1d fa3d  ;<7.?...?..=...=
0000070: 67e8 4549 6a9c 2f7f 24be 3f99 4713 e147  g.EIj./.$.?.G..G
0000080: 011c e14f 20d5 577f 668d 2135 30c2 2d47  ...O .W.f.!50.-G
0000090: 45d1 315e bc35 8936 0987 385e d238 7a9f  E.1^.5.6..8^.8z.
00000a0: 3af1 3b55 f441 2cbc 3c4e 8843 7ceb 2e25  :.;U.A,.<N.C|..%
00000b0: 1d93 3a60 15f1 4237 3fb0 4404 f949 e750  ..:`..B7?.D..I.P
00000c0: 423d b21e 265b 7cf6 2958 df2c 4edf 2c27  B=..&[|.)X.,N.,'
00000d0: c32b e42c 992c d32d 1394 2d2e 3cd9 3119  .+.,.,.-..-.<.1.
00000e0: b22e 74c3 2f41 cb30 9630 6ea4 313c dd32  ..t./A.0.0n.1<.2
00000f0: 04a1 2b34 0be1 364c 6fb8 3c32 61af 3e74  ..+4..6Lo.<2a.>t
0000100: e23e 55c3 4160 af43 6f8e 436a f544 733d  .>U.A`.Co.Cj.Ds=
0000110: eb49 e030 6e71 b43b 2ad7 3a24 af41 d345  .I.0nq.;*.:$.A.E
0000120: 5c22 c84a 7f9d 204a 3ea5 2a1d 0dcb 2b05  \".J.. J>.*...+.
0000130: 2cfd 32ba af31 46da 320f ef30 1ab5 2fe5  ,.2..1F.2..0../.
0000140: 2ff7 314a c632 20ba 3278 b6b4 34d1 b5a7  /.1J.2 .2x..4...
0000150: b0b6 bebd bc22 7b69 3235 362b 3262 283b  ....."{i256+2b(;
0000160: 287d 2531 6125 7b32 253a 2b5f 323e 315c  (}%1a%{2%:+_2>1\
0000170: 2b32 6232 405f 2c33 2d5c 323c 3262 2d23  +2b2@_,3-\2<2b-#
0000180: 642f 4e7d 2f                             d/N}/

Basically this is

"MAGIC STRING"{i256+2b(;(}%1a%{2%:+_2>1\+2b2@_,3-\2<2b-#d/N}/

This uses a custom variable-width floating point format to store the numbers. Two bits suffice for the exponent; the mantissa gets anywhere from 5 bits to 47 bits, in multiples of 7. The remaining bit per byte serves as the separator.

There seems to be some corruption going on when I copy the magic string to make an online demo, so that scores about 2 penalty points more. I'll have to figure out how to build the URL directly...


Generation program:

e# Score calculation
{1$`'.+'.%1=,10\#_@*@@*-z 4*1- 0e> ml10ml/0e>}:E;

q~]

e# Custom float format
e# Exponent goes from 2^1 to 2^4, so 2 bits
e# Each byte has 1 bit for continuation, so 7 bits available
e# That means the options for the mantissa are 5 bits, 12 bits, 19 bits, 26 bits, 33 bits, 40 bits, 47 bits
{
  :X
  0\{2/\)\_2<!}g
  e# Stack: exponent mantissa
  2 47#*i2b(;
  e# Stack: exponent mantissa-bits
  W%7/W%Wf%:M
  7,{
    )M<e_
    1_$+2b2@,#d/
  }%
  2 3$#f*
  X\f{E}
  _,,.+
  _:e<
  #)<

  \(4+2b(;\+e_7/
  _,,:!W%\.+2fb:c
}%
""*`

Online demo

\$\endgroup\$
2
  • \$\begingroup\$ Note to self: fixed point saves about 1 point. \$\endgroup\$ Commented Feb 8, 2018 at 15:40
  • \$\begingroup\$ Note to self: does tweaking the string to remove the escaped " increase the error too much to be worth it? \$\endgroup\$ Commented Feb 8, 2018 at 21:08
4
\$\begingroup\$

Jelly,  379 361  360 bytes + 0 Penalty = 360

-18 using an observation from Peter Taylor (order 10 values have leading 1 or 2, while order 1 values do not).

<3Ḣ‘_L⁵*×Ḍ
“KẸ⁺dzⱮÑ2⁵İ2ṭ¬⁴²¬¶9°ß°øİẆGẊœ%X(¢ṆḢ/8¬Ɗ’b7µ18,-;_3+\⁺Ṭœṗ“SŒƥŻƭ°}MḋṘḥfyɼ{ṅĊLƝġœ⁺ḟ8ḶhỊDṭ&æ%*ɱ¬ =¦ẉ Qh"¶:ḌĊ€ĖṢė°ġṀƬmẓSṃ÷E⁴Ȥ⁼ḋ#ØĖḂ2øzẸżƈ¥Ȧƥ7¢®|ḳẊṆƙƲɦḟɼṖỊɲṁẉɗ6ẇSɗ⁴ẉİt]ẓeṆHṚƑ½>]ɦ~T¢~ẆẆA`/6ƭṡxṠKG£Ḅ+wḃḣỤw×ḌŻƲF>Ụ]5bJḤḟCḞİḶ|ȥ9Ỵ0ụKṗT⁴ƥƁṖı×ṄtTĊG©ṀḥṬƭʂd½ḊȦуŀṣ¹ʋṖẓYL²ṅṿ&ẏdDṬIɦỵ¹b,ḷṣƭ#P'µ{GTƇẹ¥L8SƥÑṆẈėẎßṀḷƓ⁷ðḳċ¿ḶM_ḲẈg9ḢĠi+LṭẹḲẎ¤g<ṘJJĿßæ⁺(ɲỴ3ɲgkSḃIƙṭ.Ỵ&_:cĿƝı’D¤Ç€

Try it online!

How?

Creates these two constants (AKA nilads):

  • (A) all the decimal digits used (i.e. the numbers all joined up ignoring where they join and their decimal place separators), and
  • (B) the number of significant figures used by each number

Then uses those to reconstruct floating point representations of the numbers.

The full program is of this form:

<3Ḣ‘_L⁵*×Ḍ
“...’b7µ18,-;_3+\⁺Ṭœṗ“...’D¤Ç€

(where ... are encoded numbers for constructing B, and A)
and works like this:

<3Ḣ‘_L⁵*×Ḍ - Link 1, conversion helper: list of digits  e.g. [1,2,9,6,7,6,3]
<3         - less than three?                                [1,1,0,0,0,0,0]
  Ḣ        - head                                            1
   ‘       - increment                                       2
     L     - length                                          7
    _      - subtract                                        -5
      ⁵    - literal ten                                     10
       *   - exponentiate                                    0.00001
         Ḍ - undecimal (convert from base 10)                1296763
        ×  - multiply                                        12.96763
           - i.e. go from digits to a number between 3 and 30

“...’b7µ18,-;_3+\⁺Ṭœṗ“...’D¤Ç€ - Main link: no arguments
“...’                          - base 250 literal = 16242329089425509505495393436399830365761075941410177200411131173280169129083782003564646
     b7                        - to base seven = [2,0,4,3,2,4,2,4,3,2,3,3,4,2,3,5,3,3,0,3,4,2,4,4,1,4,3,4,3,2,1,5,3,5,1,5,0,3,3,3,3,3,3,3,4,3,4,2,3,2,4,5,4,0,1,3,2,4,2,5,4,2,2,4,2,3,4,4,3,3,3,2,3,3,3,3,4,4,3,3,2,0,5,3,5,2,3,1,1,6,2,3,3,3,3,3,3,1,3,3,3,3,2,3,3]
       µ                       - start a new monadic chain, call that x
        18,-                   - integer list literal = [18,-1]
            ;                  - concatenate with x = [18,-1,2,0,4,3,2,4,2,4,3,2,3,3,4,2,3,5,3,3,0,3,4,2,4,4,1,4,3,4,3,2,1,5,3,5,1,5,0,3,3,3,3,3,3,3,4,3,4,2,3,2,4,5,4,0,1,3,2,4,2,5,4,2,2,4,2,3,4,4,3,3,3,2,3,3,3,3,4,4,3,3,2,0,5,3,5,2,3,1,1,6,2,3,3,3,3,3,3,1,3,3,3,3,2,3,3]
             _3                - subtract three = [15,-4,-1,-3,1,0,-1,1,-1,1,0,-1,0,0,1,-1,0,2,0,0,-3,0,1,-1,1,1,-2,1,0,1,0,-1,-2,2,0,2,-2,2,-3,0,0,0,0,0,0,0,1,0,1,-1,0,-1,1,2,1,-3,-2,0,-1,1,-1,2,1,-1,-1,1,-1,0,1,1,0,0,0,-1,0,0,0,0,1,1,0,0,-1,-3,2,0,2,-1,0,-2,-2,3,-1,0,0,0,0,0,0,-2,0,0,0,0,-1,0,0]
                \              - cumulative reduce with:
               +               -   addition    = [15,11,10,7,8,8,7,8,7,8,8,7,7,7,8,7,7,9,9,9,6,6,7,6,7,8,6,7,7,8,8,7,5,7,7,9,7,9,6,6,6,6,6,6,6,6,7,7,8,7,7,6,7,9,10,7,5,5,4,5,4,6,7,6,5,6,5,5,6,7,7,7,7,6,6,6,6,6,7,8,8,8,7,4,6,6,8,7,7,5,3,6,5,5,5,5,5,5,5,3,3,3,3,3,2,2,2]
                               -                 ("B" significant figures, with 1 extra for the very first entry and a missing last entry)
                 ⁺             - repeat (the cumulative addition to get
                               -         partition positions) = [15,26,36,43,51,59,66,74,81,89,97,104,111,118,126,133,140,149,158,167,173,179,186,192,199,207,213,220,227,235,243,250,255,262,269,278,285,294,300,306,312,318,324,330,336,342,349,356,364,371,378,384,391,400,410,417,422,427,431,436,440,446,453,459,464,470,475,480,486,493,500,507,514,520,526,532,538,544,551,559,567,575,582,586,592,598,606,613,620,625,628,634,639,644,649,654,659,664,669,672,675,678,681,684,686,688,690]
                  Ṭ            - untruth (1s at those indices) = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,1,0,1]
                           ¤   - nilad followed by link(s) as a nilad:
                     “...’     -   base 250 literal = 1359843400513624587387936539171476193226998298019011260296145341313618054174228221564540513907677646235598576881516831048668610360011296763157596112434066354611315520656149682812674618767665174340187902467878810176398777726380939419905999301878994359788697523921181381139996049417712856948672062172666339067588570924371193873605074589083368675762348993822578635527343917860838990096610451261212984313893905548521166455769553865473552505582564371567038561498058638593905602156107761843162541595425871682506975495717864037833528438238967028958839225553104375046108287174166796728551684149317511074854072740952784245380226630675896194056265560258597385991461978628176367665065866549060168787776
                          D    -   decimal (to base 10) = [1,3,5,9,8,4,3,4,0,0,5,1,3,6,2,4,5,8,7,3,8,7,9,3,6,5,3,9,1,7,1,4,7,6,1,9,3,2,2,6,9,9,8,2,9,8,0,1,9,0,1,1,2,6,0,2,9,6,1,4,5,3,4,1,3,1,3,6,1,8,0,5,4,1,7,4,2,2,8,2,2,1,5,6,4,5,4,0,5,1,3,9,0,7,6,7,7,6,4,6,2,3,5,5,9,8,5,7,6,8,8,1,5,1,6,8,3,1,0,4,8,6,6,8,6,1,0,3,6,0,0,1,1,2,9,6,7,6,3,1,5,7,5,9,6,1,1,2,4,3,4,0,6,6,3,5,4,6,1,1,3,1,5,5,2,0,6,5,6,1,4,9,6,8,2,8,1,2,6,7,4,6,1,8,7,6,7,6,6,5,1,7,4,3,4,0,1,8,7,9,0,2,4,6,7,8,7,8,8,1,0,1,7,6,3,9,8,7,7,7,7,2,6,3,8,0,9,3,9,4,1,9,9,0,5,9,9,9,3,0,1,8,7,8,9,9,4,3,5,9,7,8,8,6,9,7,5,2,3,9,2,1,1,8,1,3,8,1,1,3,9,9,9,6,0,4,9,4,1,7,7,1,2,8,5,6,9,4,8,6,7,2,0,6,2,1,7,2,6,6,6,3,3,9,0,6,7,5,8,8,5,7,0,9,2,4,3,7,1,1,9,3,8,7,3,6,0,5,0,7,4,5,8,9,0,8,3,3,6,8,6,7,5,7,6,2,3,4,8,9,9,3,8,2,2,5,7,8,6,3,5,5,2,7,3,4,3,9,1,7,8,6,0,8,3,8,9,9,0,0,9,6,6,1,0,4,5,1,2,6,1,2,1,2,9,8,4,3,1,3,8,9,3,9,0,5,5,4,8,5,2,1,1,6,6,4,5,5,7,6,9,5,5,3,8,6,5,4,7,3,5,5,2,5,0,5,5,8,2,5,6,4,3,7,1,5,6,7,0,3,8,5,6,1,4,9,8,0,5,8,6,3,8,5,9,3,9,0,5,6,0,2,1,5,6,1,0,7,7,6,1,8,4,3,1,6,2,5,4,1,5,9,5,4,2,5,8,7,1,6,8,2,5,0,6,9,7,5,4,9,5,7,1,7,8,6,4,0,3,7,8,3,3,5,2,8,4,3,8,2,3,8,9,6,7,0,2,8,9,5,8,8,3,9,2,2,5,5,5,3,1,0,4,3,7,5,0,4,6,1,0,8,2,8,7,1,7,4,1,6,6,7,9,6,7,2,8,5,5,1,6,8,4,1,4,9,3,1,7,5,1,1,0,7,4,8,5,4,0,7,2,7,4,0,9,5,2,7,8,4,2,4,5,3,8,0,2,2,6,6,3,0,6,7,5,8,9,6,1,9,4,0,5,6,2,6,5,5,6,0,2,5,8,5,9,7,3,8,5,9,9,1,4,6,1,9,7,8,6,2,8,1,7,6,3,6,7,6,6,5,0,6,5,8,6,6,5,4,9,0,6,0,1,6,8,7,8,7,7,7,6]
                               -                          ("A" all the required digits in order)
                   œṗ          - partition at truthy indices = [[1,3,5,9,8,4,3,4,0,0,5,1,3,6],[2,4,5,8,7,3,8,7,9,3,6],[5,3,9,1,7,1,4,7,6,1],[9,3,2,2,6,9,9],[8,2,9,8,0,1,9,0],[1,1,2,6,0,2,9,6],[1,4,5,3,4,1,3],[1,3,6,1,8,0,5,4],[1,7,4,2,2,8,2],[2,1,5,6,4,5,4,0],[5,1,3,9,0,7,6,7],[7,6,4,6,2,3,5],[5,9,8,5,7,6,8],[8,1,5,1,6,8,3],[1,0,4,8,6,6,8,6],[1,0,3,6,0,0,1],[1,2,9,6,7,6,3],[1,5,7,5,9,6,1,1,2],[4,3,4,0,6,6,3,5,4],[6,1,1,3,1,5,5,2,0],[6,5,6,1,4,9],[6,8,2,8,1,2],[6,7,4,6,1,8,7],[6,7,6,6,5,1],[7,4,3,4,0,1,8],[7,9,0,2,4,6,7,8],[7,8,8,1,0,1],[7,6,3,9,8,7,7],[7,7,2,6,3,8,0],[9,3,9,4,1,9,9,0],[5,9,9,9,3,0,1,8],[7,8,9,9,4,3,5],[9,7,8,8,6],[9,7,5,2,3,9,2],[1,1,8,1,3,8,1],[1,3,9,9,9,6,0,4,9],[4,1,7,7,1,2,8],[5,6,9,4,8,6,7,2,0],[6,2,1,7,2,6],[6,6,3,3,9,0],[6,7,5,8,8,5],[7,0,9,2,4,3],[7,1,1,9,3,8],[7,3,6,0,5,0],[7,4,5,8,9,0],[8,3,3,6,8,6],[7,5,7,6,2,3,4],[8,9,9,3,8,2,2],[5,7,8,6,3,5,5,2],[7,3,4,3,9,1,7],[8,6,0,8,3,8,9],[9,0,0,9,6,6],[1,0,4,5,1,2,6],[1,2,1,2,9,8,4,3,1],[3,8,9,3,9,0,5,5,4,8],[5,2,1,1,6,6,4],[5,5,7,6,9],[5,5,3,8,6],[5,4,7,3],[5,5,2,5,0],[5,5,8,2],[5,6,4,3,7,1],[5,6,7,0,3,8,5],[6,1,4,9,8,0],[5,8,6,3,8],[5,9,3,9,0,5],[6,0,2,1,5],[6,1,0,7,7],[6,1,8,4,3,1],[6,2,5,4,1,5,9],[5,4,2,5,8,7,1],[6,8,2,5,0,6,9],[7,5,4,9,5,7,1],[7,8,6,4,0,3],[7,8,3,3,5,2],[8,4,3,8,2,3],[8,9,6,7,0,2],[8,9,5,8,8,3],[9,2,2,5,5,5,3],[1,0,4,3,7,5,0,4],[6,1,0,8,2,8,7,1],[7,4,1,6,6,7,9,6],[7,2,8,5,5,1,6],[8,4,1,4],[9,3,1,7,5,1],[1,0,7,4,8,5],[4,0,7,2,7,4,0,9],[5,2,7,8,4,2,4],[5,3,8,0,2,2,6],[6,3,0,6,7],[5,8,9],[6,1,9,4,0,5],[6,2,6,5,5],[6,0,2,5,8],[5,9,7,3,8],[5,9,9,1,4],[6,1,9,7,8],[6,2,8,1,7],[6,3,6,7,6],[6,5,0],[6,5,8],[6,6,5],[4,9,0],[6,0,1],[6,8],[7,8],[7,7],[7,6]]
                            Ç€ - call the last link (1) as a monad for €ach = [13.598434005136,24.587387936000002,5.391714761,9.322699,8.298019,11.260295999999999,14.534129999999998,13.618053999999999,17.422819999999998,21.56454,5.1390766999999995,7.646235,5.985767999999999,8.151683,10.486686,10.360009999999999,12.96763,15.759611200000002,4.34066354,6.1131552000000005,6.561490000000001,6.82812,6.746187,6.76651,7.434018,7.902467799999999,7.881010000000001,7.639876999999999,7.72638,9.394199,5.9993018,7.8994349999999995,9.7886,9.752392,11.81381,13.9996049,4.177128,5.6948672,6.2172600000000005,6.633900000000001,6.758850000000001,7.09243,7.1193800000000005,7.360500000000001,7.458900000000001,8.336860000000001,7.5762339999999995,8.993822,5.7863552,7.343916999999999,8.608388999999999,9.00966,10.45126,12.129843099999999,3.893905548,5.211664,5.5769,5.538600000000001,5.473,5.525,5.582,5.6437100000000004,5.670385,6.149800000000001,5.8638,5.939050000000001,6.0215000000000005,6.1077,6.184310000000001,6.254159,5.425871,6.825069,7.549570999999999,7.8640300000000005,7.833520000000001,8.43823,8.967020000000002,8.95883,9.225553,10.437504,6.1082871,7.416679599999999,7.285515999999999,8.414,9.31751,10.7485,4.072740899999999,5.278423999999999,5.3802259999999995,6.3067,5.89,6.194050000000001,6.2655,6.0258,5.973800000000001,5.9914000000000005,6.1978,6.281700000000001,6.3676,6.5,6.58,6.65,4.9,6.01,6.800000000000001,7.800000000000001,7.7,7.6000000000000005]
\$\endgroup\$
2
  • \$\begingroup\$ "Whether they are of order 1 or 10" is easy: if the first digit is 1 or 2, it's of order 10. Does that help golf it even further, or is it cheaper to unpack a bit array? \$\endgroup\$ Commented Feb 8, 2018 at 21:10
  • \$\begingroup\$ @PeterTaylor had not noticed, that will almost certainly save some bytes, thanks! \$\endgroup\$ Commented Feb 8, 2018 at 21:19
3
\$\begingroup\$

Bubblegum, 403 + 9.12 = 412.12

00000000: 1551 5116 c030 04fb 7718 af20 e2fe 17db  .QQ..0..w.. ....
00000010: f2d1 454d 4322 cae7 d8d5 ef4d 142c db87  ..EMC".....M.,..
00000020: 5bdc 2bd8 785d 6cf4 22ec bc32 7167 f43c  [.+.x]l."..2qg.<
00000030: be38 8bf0 c4cb 8345 fb54 4759 9423 f8a6  .8.....E.TGY.#..
00000040: 2dd6 3b93 6919 3ee8 691b 8fba b758 5b47  -.;.i.>.i....X[G
00000050: 236b 6cfc 380b 1a3d 26c0 b278 de04 0845  #kl.8..=&..x...E
00000060: 85f7 c222 fdb0 288b f19d 4344 5a7b f503  ..."..(...CDZ{..
00000070: 6ada e011 1533 69f0 41f4 fdc8 64e8 be8d  j....3i.A...d...
00000080: e02a 0026 6c5d 3a83 7f70 2f1b ab88 8ca7  .*.&l]:..p/.....
00000090: 5fa8 e36a b64d 1425 f73a ee0c aab9 eb1a  _..j.M.%.:......
000000a0: 3b5f 1282 c9ba 9401 8c62 58b4 b5c7 6e24  ;_.......bX...n$
000000b0: 6d1c d7c4 aa7f c626 7e44 d569 8a21 c7d6  m......&~D.i.!..
000000c0: df65 d78f 1157 b495 4ea5 7b28 77ab 4035  .e...W..N.{(w.@5
000000d0: 9d45 561b fdae 9869 e34b d44c ea45 6b31  .EV....i.K.L.Ek1
000000e0: 46c7 63f1 ecfc bd03 645a 4f24 645a a4f6  F.c.....dZO$dZ..
000000f0: 1a56 ceab 7b33 ade1 3202 681b d19f a088  .V..{3..2.h.....
00000100: 1f7a 4b97 1c7d 9952 d1b5 21dc 571c d9dc  .zK..}.R..!.W...
00000110: 2702 a204 a254 f665 08e2 ed0a d451 c2a7  '....T.e.....Q..
00000120: 6344 df39 5c65 98f3 7092 d537 2bc3 897e  cD.9\e..p..7+..~
00000130: 25ac 9a34 7a17 b324 17fb 5238 64d9 79e6  %..4z..$..R8d.y.
00000140: cc94 a475 edbc 3675 6372 45d2 01ec c9ae  ...u..6ucrE.....
00000150: e44c 403c d1da 5eec 841e 6d73 acfd 6d6e  .L@<..^...ms..mn
00000160: 3f8d 94cb 4e39 507c 995a 4f3d ac94 9da8  ?...N9P|.ZO=....
00000170: afa5 cb13 2378 3994 da2d 0a2e 5a35 b754  ....#x9..-..Z5.T
00000180: 0943 9a0b 2b92 d151 1a6a 77a6 9c96 abb3  .C..+..Q.jw.....
00000190: ffc1 07                                  ...

Try it online!

\$\endgroup\$
0
3
\$\begingroup\$

Jelly, 116 bytes + 429.796016684433 Penalty = 545.796016684433

“tẏØA5X¶tɱḅÐ-ı3OMm⁾¦ȷ #""*00-.Bı0FF_y¤ß÷!"&&)+5,=æ)8=Nc¡ÑÞŒŒŒÞßßñçðıȷñ÷Ø#,//6==@Nȷ*(6AR£ÑØøðñ÷ıııñ÷øþ !€ı#/-,‘+47÷12

Try it online!

Nothing particularly spectacular, a code-page index list, “...‘ (numbers between 0 and 249), to each of which we add 47, +47, and then divide by 12, ÷12.

\$\endgroup\$
3
\$\begingroup\$

Jelly, 164 bytes + 409.846 = 573.846

“?#4ß<Ʋƒ⁻µ`kḞÑ6{ɱ~.ṣ¬⁷Ḷlŀ⁸ẎṘ£ỌgfĖỌƒ⁻ḋN?ḤḞ{ị#qp⁵mp&WṘƙ=/rŻ-vn⁼ẊTị}W;!z€ȦMẊẇİ_D8ỴtṫQAẎḣṬr¥1J3Ƙ~ʋ$ĿẠ7þƭ8ṛM{ịḟƇỵ÷b?°6I@?Ȥ⁾d⁹DẈcȷv5ⱮAJb}øDȯRµ’Ds3Ḍ÷³×⁵$2R;6r⁵¤¤;15r18¤¤¦Y

Try it online!

There is a compressed number in there that is the concatenation of the first three digits of each energy (including trailing zeroes). I get a list of these three digit numbers with Ds3Ḍ then divide each by 100 with ÷³. Some of the numbers should only be divided by 10, so I multiply some of these by 10 to improve the score slightly (×⁵$2R;6r⁵¤¤;15r18¤¤¦).

Previous version:

Jelly, 50 bytes + 571.482 penalty = 621.482

“¡9;ẋkñ¬nƑḳ_gÐ.RḊụʠṁṬl⁾l>ɼXZĖSṠƈ;cḶ=ß³ṾAiʠʠɼZÞ⁹’DY

Try it online!

Rounded each energy to it's nearest single digit integer. Concatenated together this gives 995989999958689999467777788889689999466777777889679999456656666666666657888899996778994556666666666677567888. “¡9;ẋkñ¬nƑḳ_gÐ.RḊụʠṁṬl⁾l>ɼXZĖSṠƈ;cḶ=ß³ṾAiʠʠɼZÞ⁹’ is a base 250 number which yields this. DY joins the digits of this number with newlines.

\$\endgroup\$
3
\$\begingroup\$

Java 8, 48 bytes + 625.173330827107 Penalty = 673.173330827107

v->{for(int i=108;i-->0;System.out.println(6));}

Try it online.

Initial version that prints 108 times 6. Will try to improve from here.

\$\endgroup\$
3
\$\begingroup\$

J, 390 bytes + 183.319 Penalty = 573.319

d=.'5@-103659=-/-02247,...../////1-/1135,-...////0/0-/0124+--------.--....-.///00012.//012,--.-...--......,..///'
f=.'[ZG@=:U]JX-`~/PD~kB+XrjlKzx_hG~ynkq~1e5_k)+DMAY~nB\ M,y5YUOTZ`c.v}"*29JrVvsK~~6K*I<I?j'';F>y3:"~~3<DRZaz!ppf\'
p=.'tj1;p#Iq<M{^Z1c l~''@/q^aH9*~`J}~v8F~gQiGy8~%ye^F`Gt~-~G1ev>R4E$~F{/mKJ[S~HCrfxXkscWHku;t"c IWZF.n1l',9$' '
echo,.(_40+a.i.d)+(100%~_32+a.i.f)+1e4%~_32+a.i.p

Try it online!

I rounded the numbers to four decimal digits and split them into one list for integer parts, one list for the first 2 fraction digits and one for the second 2 fraction digits. I encoded each number with a printable character. For decoding I simpy extract the ingerer and fraction parts of a number from the associated character lists and assemble them back to float.

J, 602 bytes + 0 Penalty = 602

q=.'qy7?JOZp@''T1}Ciz={3L/0rHp/r}`M{m^ZHZSy55MYPBaNcV+\?A%/{eyQxQPkDs8W''@m$\6wZsV%KjI''_9"o\XMCP+vU=S3''c3\IKD@ovEW''4LX2O=>n&dgNktY><Ru_TvNpArL?}Y642=}5Hb"yYsD19$<OP2<|Jo)!8S`^9N3w{Q]968P2VF`[(2HOa%XL*V|,[8PcL)}w8"*l%JNC{amnCNx\yH73(pmJGCDq?8@D$ww{X`t0[o.`$''RB&eXiP|_u#9WBFS%U:3|O.U+is5E$A[c{1MpJ@Dw&^rpM_N:M^:o&!HPX9?0i}{j?%2W20z>Q?AOw!fuTWC"Q{-Er'
f=:3 :0
a=.0$0 while.*#y do.l=.1+{.y
a=.a,<' '-.~":}.l{.y
y=.l}.y
end.a
)
echo;(('.',~":"0)&.>_40+a.i.'5@-103659=-/-02247,...../////1-/1135,-...////0/0-/0124+--------.--....-.///00012.//012,--.-...--......,..///'),.(f 12,10#.inv 94x#._32+a.i.q),.<CR

Try it online!

This time I went for a slightly different approach. I split the numbers to 2 streams - the first one contains the integer parts which are simply encoded with a single printable character. The second stream contains the entire fractional parts. I removed all intervals between the digits and prepended each substring with its length 1-9 (I tweaked the first fraction, wich is 13 digits long). Then I encoded this list as a base 94 number, presented it as a list of characters.

About 20 bytes can be saved if the verb is rewriten as tacit one.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.