← RoseCode

ROSECODE 243

A special set

sinan · Programming ·

Let S be a set like {1,...,M} with cardinality N. Any element but the first can be written as a sum of some two lesser and not necessarily distinct elements. How many such sets can you find if M=1881 and N=15? Input format: cnt,S_1001 (S_1001 means 1001st such set) Example: cnt,{1,2,3,6,7,13,26,52,104,208,209,418,836,1045,1881} if asked 101st such set Sets are ordered comparing each element from 1 to M: 100: {1,2,3,6,7,13,26,52,104,208,209,418,627,1254,1881} 101: {1,2,3,6,7,13,26,52,104,208,209,418,836,1045,1881} Here, there is a difference at 13th elements. [My timing: 2s]