# Subset question (math)

Show 40 post(s) from this thread on one page
Page 2 of 2 First 12
• 12-25-2013, 04:18 AM
007Julien
Post to remove. Sorry Thanks
• 12-25-2013, 04:28 AM
007Julien
It's better to store the value 1865 (which is 11101001001) than 1, 4, 7 , 9, 10, 11 !

Then the following array store all the possible subsets

Code:

`var subSets="63,95,111,119,123,125,126,159,175,183,187,189,190,207,215,219,221,222,231,235,237,238,243,245,246,249,250,252,287,303,311,315,317,318,335,343,347,349,350,359,363,365,366,371,373,374,377,378,380,399,407,411,413,414,423,427,429,430,435,437,438,441,442,444,455,459,461,462,467,469,470,473,474,476,483,485,486,489,490,492,497,498,500,504,543,559,567,571,573,574,591,599,603,605,606,615,619,621,622,627,629,630,633,634,636,655,663,667,669,670,679,683,685,686,691,693,694,697,698,700,711,715,717,718,723,725,726,729,730,732,739,741,742,745,746,748,753,754,756,760,783,791,795,797,798,807,811,813,814,819,821,822,825,826,828,839,843,845,846,851,853,854,857,858,860,867,869,870,873,874,876,881,882,884,888,903,907,909,910,915,917,918,921,922,924,931,933,934,937,938,940,945,946,948,952,963,965,966,969,970,972,977,978,980,984,993,994,996,1000,1008,1055,1071,1079,1083,1085,1086,1103,1111,1115,1117,1118,1127,1131,1133,1134,1139,1141,1142,1145,1146,1148,1167,1175,1179,1181,1182,1191,1195,1197,1198,1203,1205,1206,1209,1210,1212,1223,1227,1229,1230,1235,1237,1238,1241,1242,1244,1251,1253,1254,1257,1258,1260,1265,1266,1268,1272,1295,1303,1307,1309,1310,1319,1323,1325,1326,1331,1333,1334,1337,1338,1340,1351,1355,1357,1358,1363,1365,1366,1369,1370,1372,1379,1381,1382,1385,1386,1388,1393,1394,1396,1400,1415,1419,1421,1422,1427,1429,1430,1433,1434,1436,1443,1445,1446,1449,1450,1452,1457,1458,1460,1464,1475,1477,1478,1481,1482,1484,1489,1490,1492,1496,1505,1506,1508,1512,1520,1551,1559,1563,1565,1566,1575,1579,1581,1582,1587,1589,1590,1593,1594,1596,1607,1611,1613,1614,1619,1621,1622,1625,1626,1628,1635,1637,1638,1641,1642,1644,1649,1650,1652,1656,1671,1675,1677,1678,1683,1685,1686,1689,1690,1692,1699,1701,1702,1705,1706,1708,1713,1714,1716,1720,1731,1733,1734,1737,1738,1740,1745,1746,1748,1752,1761,1762,1764,1768,1776,1799,1803,1805,1806,1811,1813,1814,1817,1818,1820,1827,1829,1830,1833,1834,1836,1841,1842,1844,1848,1859,1861,1862,1865,1866,1868,1873,1874,1876,1880,1889,1890,1892,1896,1904,1923,1925,1926,1929,1930,1932,1937,1938,1940,1944,1953,1954,1956,1960,1968,1985,1986,1988,1992,2000,2016,2079,2095,2103,2107,2109,2110,2127,2135,2139,2141,2142,2151,2155,2157,2158,2163,2165,2166,2169,2170,2172,2191,2199,2203,2205,2206,2215,2219,2221,2222,2227,2229,2230,2233,2234,2236,2247,2251,2253,2254,2259,2261,2262,2265,2266,2268,2275,2277,2278,2281,2282,2284,2289,2290,2292,2296,2319,2327,2331,2333,2334,2343,2347,2349,2350,2355,2357,2358,2361,2362,2364,2375,2379,2381,2382,2387,2389,2390,2393,2394,2396,2403,2405,2406,2409,2410,2412,2417,2418,2420,2424,2439,2443,2445,2446,2451,2453,2454,2457,2458,2460,2467,2469,2470,2473,2474,2476,2481,2482,2484,2488,2499,2501,2502,2505,2506,2508,2513,2514,2516,2520,2529,2530,2532,2536,2544,2575,2583,2587,2589,2590,2599,2603,2605,2606,2611,2613,2614,2617,2618,2620,2631,2635,2637,2638,2643,2645,2646,2649,2650,2652,2659,2661,2662,2665,2666,2668,2673,2674,2676,2680,2695,2699,2701,2702,2707,2709,2710,2713,2714,2716,2723,2725,2726,2729,2730,2732,2737,2738,2740,2744,2755,2757,2758,2761,2762,2764,2769,2770,2772,2776,2785,2786,2788,2792,2800,2823,2827,2829,2830,2835,2837,2838,2841,2842,2844,2851,2853,2854,2857,2858,2860,2865,2866,2868,2872,2883,2885,2886,2889,2890,2892,2897,2898,2900,2904,2913,2914,2916,2920,2928,2947,2949,2950,2953,2954,2956,2961,2962,2964,2968,2977,2978,2980,2984,2992,3009,3010,3012,3016,3024,3040,3087,3095,3099,3101,3102,3111,3115,3117,3118,3123,3125,3126,3129,3130,3132,3143,3147,3149,3150,3155,3157,3158,3161,3162,3164,3171,3173,3174,3177,3178,3180,3185,3186,3188,3192,3207,3211,3213,3214,3219,3221,3222,3225,3226,3228,3235,3237,3238,3241,3242,3244,3249,3250,3252,3256,3267,3269,3270,3273,3274,3276,3281,3282,3284,3288,3297,3298,3300,3304,3312,3335,3339,3341,3342,3347,3349,3350,3353,3354,3356,3363,3365,3366,3369,3370,3372,3377,3378,3380,3384,3395,3397,3398,3401,3402,3404,3409,3410,3412,3416,3425,3426,3428,3432,3440,3459,3461,3462,3465,3466,3468,3473,3474,3476,3480,3489,3490,3492,3496,3504,3521,3522,3524,3528,3536,3552,3591,3595,3597,3598,3603,3605,3606,3609,3610,3612,3619,3621,3622,3625,3626,3628,3633,3634,3636,3640,3651,3653,3654,3657,3658,3660,3665,3666,3668,3672,3681,3682,3684,3688,3696,3715,3717,3718,3721,3722,3724,3729,3730,3732,3736,3745,3746,3748,3752,3760,3777,3778,3780,3784,3792,3808,3843,3845,3846,3849,3850,3852,3857,3858,3860,3864,3873,3874,3876,3880,3888,3905,3906,3908,3912,3920,3936,3969,3970,3972,3976,3984,4000,4032".split(',');`
• 12-25-2013, 04:37 AM
007Julien
It's possible to store all subsets like this

Code:

`var sst="63,95,111,119,123,125,126,159,175,183,187,189,190,207,215,219,221,222,231,235,237,238,243,245,246,249,250,252,287,303,311,315,317,318,335,343,347,349,350,359,363,365,366,371,373,374,377,378,380,399,407,411,413,414,423,427,429,430,435,437,438,441,442,444,455,459,461,462,467,469,470,473,474,476,483,485,486,489,490,492,497,498,500,504,543,559,567,571,573,574,591,599,603,605,606,615,619,621,622,627,629,630,633,634,636,655,663,667,669,670,679,683,685,686,691,693,694,697,698,700,711,715,717,718,723,725,726,729,730,732,739,741,742,745,746,748,753,754,756,760,783,791,795,797,798,807,811,813,814,819,821,822,825,826,828,839,843,845,846,851,853,854,857,858,860,867,869,870,873,874,876,881,882,884,888,903,907,909,910,915,917,918,921,922,924,931,933,934,937,938,940,945,946,948,952,963,965,966,969,970,972,977,978,980,984,993,994,996,1000,1008,1055,1071,1079,1083,1085,1086,1103,1111,1115,1117,1118,1127,1131,1133,1134,1139,1141,1142,1145,1146,1148,1167,1175,1179,1181,1182,1191,1195,1197,1198,1203,1205,1206,1209,1210,1212,1223,1227,1229,1230,1235,1237,1238,1241,1242,1244,1251,1253,1254,1257,1258,1260,1265,1266,1268,1272,1295,1303,1307,1309,1310,1319,1323,1325,1326,1331,1333,1334,1337,1338,1340,1351,1355,1357,1358,1363,1365,1366,1369,1370,1372,1379,1381,1382,1385,1386,1388,1393,1394,1396,1400,1415,1419,1421,1422,1427,1429,1430,1433,1434,1436,1443,1445,1446,1449,1450,1452,1457,1458,1460,1464,1475,1477,1478,1481,1482,1484,1489,1490,1492,1496,1505,1506,1508,1512,1520,1551,1559,1563,1565,1566,1575,1579,1581,1582,1587,1589,1590,1593,1594,1596,1607,1611,1613,1614,1619,1621,1622,1625,1626,1628,1635,1637,1638,1641,1642,1644,1649,1650,1652,1656,1671,1675,1677,1678,1683,1685,1686,1689,1690,1692,1699,1701,1702,1705,1706,1708,1713,1714,1716,1720,1731,1733,1734,1737,1738,1740,1745,1746,1748,1752,1761,1762,1764,1768,1776,1799,1803,1805,1806,1811,1813,1814,1817,1818,1820,1827,1829,1830,1833,1834,1836,1841,1842,1844,1848,1859,1861,1862,1865,1866,1868,1873,1874,1876,1880,1889,1890,1892,1896,1904,1923,1925,1926,1929,1930,1932,1937,1938,1940,1944,1953,1954,1956,1960,1968,1985,1986,1988,1992,2000,2016,2079,2095,2103,2107,2109,2110,2127,2135,2139,2141,2142,2151,2155,2157,2158,2163,2165,2166,2169,2170,2172,2191,2199,2203,2205,2206,2215,2219,2221,2222,2227,2229,2230,2233,2234,2236,2247,2251,2253,2254,2259,2261,2262,2265,2266,2268,2275,2277,2278,2281,2282,2284,2289,2290,2292,2296,2319,2327,2331,2333,2334,2343,2347,2349,2350,2355,2357,2358,2361,2362,2364,2375,2379,2381,2382,2387,2389,2390,2393,2394,2396,2403,2405,2406,2409,2410,2412,2417,2418,2420,2424,2439,2443,2445,2446,2451,2453,2454,2457,2458,2460,2467,2469,2470,2473,2474,2476,2481,2482,2484,2488,2499,2501,2502,2505,2506,2508,2513,2514,2516,2520,2529,2530,2532,2536,2544,2575,2583,2587,2589,2590,2599,2603,2605,2606,2611,2613,2614,2617,2618,2620,2631,2635,2637,2638,2643,2645,2646,2649,2650,2652,2659,2661,2662,2665,2666,2668,2673,2674,2676,2680,2695,2699,2701,2702,2707,2709,2710,2713,2714,2716,2723,2725,2726,2729,2730,2732,2737,2738,2740,2744,2755,2757,2758,2761,2762,2764,2769,2770,2772,2776,2785,2786,2788,2792,2800,2823,2827,2829,2830,2835,2837,2838,2841,2842,2844,2851,2853,2854,2857,2858,2860,2865,2866,2868,2872,2883,2885,2886,2889,2890,2892,2897,2898,2900,2904,2913,2914,2916,2920,2928,2947,2949,2950,2953,2954,2956,2961,2962,2964,2968,2977,2978,2980,2984,2992,3009,3010,3012,3016,3024,3040,3087,3095,3099,3101,3102,3111,3115,3117,3118,3123,3125,3126,3129,3130,3132,3143,3147,3149,3150,3155,3157,3158,3161,3162,3164,3171,3173,3174,3177,3178,3180,3185,3186,3188,3192,3207,3211,3213,3214,3219,3221,3222,3225,3226,3228,3235,3237,3238,3241,3242,3244,3249,3250,3252,3256,3267,3269,3270,3273,3274,3276,3281,3282,3284,3288,3297,3298,3300,3304,3312,3335,3339,3341,3342,3347,3349,3350,3353,3354,3356,3363,3365,3366,3369,3370,3372,3377,3378,3380,3384,3395,3397,3398,3401,3402,3404,3409,3410,3412,3416,3425,3426,3428,3432,3440,3459,3461,3462,3465,3466,3468,3473,3474,3476,3480,3489,3490,3492,3496,3504,3521,3522,3524,3528,3536,3552,3591,3595,3597,3598,3603,3605,3606,3609,3610,3612,3619,3621,3622,3625,3626,3628,3633,3634,3636,3640,3651,3653,3654,3657,3658,3660,3665,3666,3668,3672,3681,3682,3684,3688,3696,3715,3717,3718,3721,3722,3724,3729,3730,3732,3736,3745,3746,3748,3752,3760,3777,3778,3780,3784,3792,3808,3843,3845,3846,3849,3850,3852,3857,3858,3860,3864,3873,3874,3876,3880,3888,3905,3906,3908,3912,3920,3936,3969,3970,3972,3976,3984,4000,4032".split(',');`
In this array (see the split(',') at the end) each value describes a subset.
For example 1865, which is 11101001001, represents 1, 4, 7, 9, 10, 11 (read the ranks from rigth to left)
• 12-25-2013, 12:33 PM
bionoid
Sorry, I just had to do another one... based more on 007Julien's code, but using bitshifting instead of the predefined sets.

Code:

```<!DOCTYPE html> <html lang="en"> <head>         <meta charset="utf-8" />         <title>Subset question (math)</title> </head> <body>         <script type="text/javascript">                 var                         sets = [],                         n, i, j, o;                 for (n = 63; n < 4033; ++n) {                         for (i = 0, j = 0, o = ''; i < 12; ++i) {                                 if ((n >> i) & 1) {                                         o += (j++ ? ', ' : '') + (i < 9 ? ' ' : '') + (i + 1);                                 }                         }                         if (6 === j) {sets.push(o);}                 }                 document.write('<pre>', sets.sort().join('<br />'), '</pre>');         </script> </body> </html>```
Output

1, 2, 3, 4, 5, 6
1, 2, 3, 4, 5, 7
1, 2, 3, 4, 5, 8
1, 2, 3, 4, 5, 9
1, 2, 3, 4, 5, 10
1, 2, 3, 4, 5, 11
1, 2, 3, 4, 5, 12
1, 2, 3, 4, 6, 7
1, 2, 3, 4, 6, 8
1, 2, 3, 4, 6, 9
...

5, 7, 8, 10, 11, 12
5, 7, 9, 10, 11, 12
5, 8, 9, 10, 11, 12
6, 7, 8, 9, 10, 11
6, 7, 8, 9, 10, 12
6, 7, 8, 9, 11, 12
6, 7, 8, 10, 11, 12
6, 7, 9, 10, 11, 12
6, 8, 9, 10, 11, 12
7, 8, 9, 10, 11, 12
Show 40 post(s) from this thread on one page
Page 2 of 2 First 12

## X vBulletin 4.2.2 Debug Information

• Page Generation 0.18364 seconds
• Memory Usage 2,392KB
• Queries Executed 11 (?)
Template Usage (23):
• (3)bbcode_code_printable
• (1)footer
• (1)gobutton
• (1)navbar_moderation
• (1)navbar_noticebit
• (2)option
• (1)pagenav
• (1)pagenav_curpage
• (1)spacer_close
• (1)spacer_open

Phrase Groups Available (3):
• global
• postbit
Included Files (19):
• ./global.php
• ./includes/class_bootstrap.php
• ./includes/init.php
• ./includes/class_core.php
• ./includes/config.php
• ./includes/functions.php
• ./includes/class_friendly_url.php
• ./includes/class_hook.php
• ./includes/class_bootstrap_framework.php
• ./vb/vb.php
• ./vb/phrase.php
• ./includes/functions_calendar.php
• ./includes/class_bbcode_alt.php
• ./includes/class_bbcode.php
• ./includes/functions_bigthree.php
• ./includes/functions_notice.php

Hooks Called (43):
• init_startup
• init_startup_session_setup_start
• database_pre_fetch_array
• database_post_fetch_array
• init_startup_session_setup_complete
• global_bootstrap_init_start
• global_bootstrap_init_complete
• cache_permissions
• fetch_foruminfo
• global_state_check
• global_bootstrap_complete
• global_start
• style_fetch
• global_setup_complete
• friendlyurl_resolve_class
• friendlyurl_clean_fragment
• friendlyurl_geturl
• pagenav_page
• cache_templates
• cache_templates_process
• template_register_var
• template_render_output
• fetch_template_start
• fetch_template_complete
• parse_templates