← RoseCode

ROSECODE 379

A special subset

sinan · Programming ·

Let SN be the set of positive numbers less or equal to N. SN={1,2,...,N} Consider the subsets with the following properties:
  • none of the elements is a prime number
  • none of the elements contains any prime digit(s)
  • none of any 2 elements' difference is a prime number
  • none of any 2 elements' difference contains any prime digit(s)
  • Find the subset of S100000 with the maximal sum. Answer format: sum Example: 20 for S10 subsets: {1}, {1,9}, {1,9,10}, {1,10}, {4}, {4,8}, {4,10}, {6}, {6,10}, {8}, {8,9}, {9}, {9,10}, {10} [My timing: < 1m]