Program the sequence \$R_k\$: all numbers that are sum of square roots of some(maybe one) natural numbers \$\left\{\sum_{i\in A}\sqrt i\middle|A\subset \mathbb{N}\right\}\$, in ascending order without duplication. Outputting zero is optional.
You should do one of:
- Take an index k and output \$R_k\$, either 0 or 1 indexing
- Take a positive integer k and output the first \$k\$ elements of \$R\$
- Output the whole sequence
Shortest code in each language wins. Beware of floating error, which returns \$\sqrt 2+\sqrt 8=\sqrt {18}\$ twice using my raw code, which is disallowed.
First few elements:
(0,)1,1.4142135623730951,1.7320508075688772,2,2.23606797749979,2.414213562373095,2.449489742783178,2.6457513110645907,2.732050807568877,2.8284271247461903,3,3.1462643699419726,3.1622776601683795,3.23606797749979,3.3166247903554,3.414213562373095,3.449489742783178,3.4641016151377544,3.605551275463989,3.6457513110645907,3.6502815398728847,3.732050807568877,3.7416573867739413,3.8284271247461903,3.863703305156273,3.872983346207417,3.968118785068667,4,4.059964873437686,4.123105625617661,4.146264369941973,4.16227766016838,4.1815405503520555,4.23606797749979,4.242640687119286,4.3166247903554,4.358898943540674,4.377802118633468,4.414213562373095,4.449489742783178,4.464101615137754,4.47213595499958,4.5604779323150675,4.576491222541475,4.58257569495584,4.60555127546399,4.645751311064591,4.650281539872885,4.685557720282968,4.69041575982343,4.730838352728495,4.732050807568877,4.741657386773941,4.795831523312719,4.82842712474619,4.863703305156273,4.872983346207417,4.878315177510849,4.8818192885643805,4.894328467737257,4.898979485566356,4.9681187850686666,5,5.0197648378370845,5.048675597924277,5.059964873437686,5.06449510224598,5.095241053847769,5.0990195135927845,5.123105625617661,5.146264369941973,5.155870949147037,5.16227766016838,5.1815405503520555,5.196152422706632,5.23606797749979,5.242640687119286,5.277916867529369,5.287196908580512,5.291502622129181,5.3166247903554,5.337602083032866,5.358898943540674,5.377802118633468,5.382332347441762,5.385164807134504,5.39834563766817,5.414213562373095,5.449489742783178,5.464101615137754,5.47213595499958,5.4737081943428185,5.4741784358107815,5.477225575051661,5.5373191879907555,5.55269276785519,5.5604779323150675,5.5677643628300215,5.576491222541474