8
$\begingroup$

I have a class of numbers; this class of numbers contains a certain number if and only if it is baumic. The following are baumic numbers:

1, 6, 9, 15, 20, 21, 30, 33, 39, 45, 50, 51, 56, 57, 69, 70, 72, 75, 84, 87, 93

All other numbers under 100 are non-baumic numbers.

In addition to 9 (1 nine), 999,999 (6 nines), 99,999,999 (8 nines), 9,999,999,999 (10 nines), and 99,999,999,999,999 (14 nines) are baumic numbers.

What exactly is a baumic number?

Feel free to ask me if $x$ is a baumic number, and best of luck, puzzlers!


Notes:

  • $B(x)=y$ is a baumic number.
  • $B(x)\in\mathbb{Z^*}$ — All baumic numbers are non-negative integers.

Hint 1

It took me a while to come up with a name for this class; I settled on baumic because, hey! German! Anyhow, here was the other likely candidate for the number class: decrebescent. Perhaps that helps...

Hint 2

42XRwBSfx0ib79FcgACIgACIgACIgACIgACIgoAXvACIgACIgACIgACIgACIgACIgARCIgAiCuACIgACIgACIgACIgACIgACIgACIgAiCuACIgACIgACIgACIgACIgACIgACIgoRgLgACIgACIgACIgACIgACIgACIgAiCc9CIgACIgACIgACIgACIgACIgAiCp9Fcg0nT9wTa9wTMR79VSQBSMfBHIqASbgACIRgACIgACIgoAXvACIgACIgACIgACIgoQafBHI95UP8kWP8EzeflEUgoCItBCIw8FcgoAXg8CIgAiC4BCIgAiC6kSfQtnYihGdh1GXg4WacBCcgQmbhBSfxsSa79FcRg0DPgk2XwBCZuFGI4BCfg0GLO9Fcs4iLuwSMfBHLw8FcoACbhJXZuV2RZg4WSKkgC1ACIzkgCc9CIJoQNxACIyACIKw1LgACIRKAzMgACI
What, you didn't think it would be that easy, did you? BTW, there are multiple instances of one letter that don't belong, and its $\tiny{\in_2}\!\!\!\Huge{\color{purple}{purple}}!\textsf{ :D}$. You gotta do a bit of thinking.

Hint 2.b

Flip Hint 2 $64+1$ times.


Perhaps a hint. Mostly observations.

This class of numbers fascinates me. You guys are right when you say prime numbers are intrinsically related with the Baumic numbers. Truly, I conjectured some of the generalizations of Baumic numbers myself. I am not rightly sure as to whether or not my observations will help you guys, but I'm sure it might.

  1. Conjecture 1. $\forall x>0[\neg B(2^x)]$ (No power of two greater than one is a Baumic number.
  2. Conjecture 2. $\forall x>0\forall y\exists n[y=2^n\implies \neg B(y^x)]$ (No power of a number that is itself a power of two is a Baumic number.)

If no one gets it by the end of the week, I believe I shall post a hint that will effectively give the answer. Or perhaps the code that I use for Baumic numbers.

$\endgroup$
  • 5
    $\begingroup$ I thought I was so clever. I googled mathematicians named Baum, and found Paul Baum, who co-formulated the Baum-Connes conjecture. Aha! I was onto something! Then I went to the wikipedia page: en.wikipedia.org/wiki/Baum%E2%80%93Connes_conjecture and read a couple of completely unintelligible paragraphs before my eyes glazed over and I left the page. Back to square 1! $\endgroup$ – VictorHenry Jul 13 '15 at 20:37
  • 6
    $\begingroup$ I think by $\mathbb C$ you mean $\mathbb C\setminus \mathbb R$. $\endgroup$ – Edward Jul 13 '15 at 23:12
  • 2
    $\begingroup$ I assume you're looking for attempts to explain what makes a number baumic, but the question doesn't actually state this. $\endgroup$ – dennisdeems Jul 14 '15 at 1:34
  • 3
    $\begingroup$ It looks like a lot of people have been (justifiably) confused by your (non-standard) use of the symbol $\mathbb{C}$. You could eliminate this confusion by just deleting all reference to imaginary numbers, since your first axiom already guarantees that all baumic numbers are integers (and therefore, not imaginary). Indeed, it seems to me that you could just say, "all baumic numbers are nonnegative integers" and leave it at that (one axiom, not three). $\endgroup$ – mathmandan Jul 15 '15 at 18:09
  • 1
    $\begingroup$ @CᴏɴᴏʀO'Bʀɪᴇɴ are you sure 180 isn't baumic? $\endgroup$ – martin Jul 22 '15 at 18:25
8
$\begingroup$

I believe I know how to tell whether certain numbers are Baumic:

Let $P_n$ be the $n^{th}$ prime number: $P_1=2$, $P_2=3$, etc.

Baumic Condition 1: For all $x>2$, $x$ is Baumic if its prime factorization has $n$ terms (including repeats) and it is divisible by $P_n$.

This rule seems to hold for all numbers less than $100$: for any prime $p$, $3*p$ is Baumic. For any (not necessarily distinct) primes $p$ and $q$, $5*p*q$ is Baumic, and so on.

Baumic condition 1 seems to be sufficient for a number to be Baumic, but there are Baumic numbers that do not meet it:

$1$ is Baumic, but does not meet the condition. $72=2^33^2$ is Baumic, but has $5$ prime factors and yet is not divisible by $P_5=11$. None of $999999$, $99999999$, $9999999999$, and $9999999999999$ meet the condition, either.

There is one other issue with the condition, as well:

Without the $x>2$ condition, Baumic Condition 1 would predict that $2$ is a Baumic number. The condition does seem to work for numbers greater than $2$, though.

If Baumic Condition 1 holds, these numbers between $100$ and $200$ are Baumic:

$105$, $110$, $111$, $123$, $125$, $126$, $129$, $130$, $140$, $141$, $159$, $165$, $170$, $175$, $176$, $177$, $183$, $189$, $190$, $195$, $196$

$\endgroup$
  • $\begingroup$ That is 99% correct. It is how I obtained the baumic condition that allows 1 to be baumic... Try plugging in 'baum' into google translate. $\endgroup$ – Conor O'Brien Jul 14 '15 at 23:22
  • $\begingroup$ Baum is German for tree $\endgroup$ – CodeNewbie Jul 14 '15 at 23:49
  • $\begingroup$ @ConorOBrien It still seems like my condition misses many Baumic numbers. Are all of my predicted Baumic numbers from 100 to 200 correct? Are there any other Baumic numbers between 100 and 200? $\endgroup$ – John Stevens Jul 15 '15 at 0:17
  • 1
    $\begingroup$ @Cᴏɴᴏʀ i.stack.imgur.com/NPnZw.png Now it's clear =) $\endgroup$ – 2012rcampion Jul 15 '15 at 15:44
  • 3
    $\begingroup$ A couple of observations: The three baumic numbers that @JohnStevens's method could not predict ($72$, $108$ and $162$) all have five prime factors, all of them smaller than $5$ (i.e. $2$ or $3$). But $48=2*2*2*2*3$ is not baumic. This made me think that more than four $2$'s are not allowed. Pretty patchy... But then I also saw that John's false positive, $176=2*2*2*2*11$, has four $2$'s! So maybe there's something in it after all. In any case, the analogy of three prime factors all smaller than $3$ (i.e. $2$) doesn't work - $8$ isn't baumic. $\endgroup$ – Angkor Jul 16 '15 at 16:18
3
$\begingroup$

Hint 2 contains a

reversed, Base64 encoded string with the character R randomly inserted to corrupt it.

It decodes to:

        30
        /\
       2  15
          /\
         3  5
 
     In general (p_0,p_1,...,p_N,m | x and p_i <= p_{i+1} and p \in \mathbb{P}):
         x
        / \
      p_0  m * PI_{1<=i<=N} p_i
                 /\
               m * p_1 PI_{1<=i<=N} p_i
                       /\
                         .
                          .
                           .
                           /\
                     p_{n-1} p
 

If we are to believe that each parent node is the product of its two child nodes, then we have:

$$ m\prod_{i=1}^{N}p_i=m\ p_1\prod_{i=1}^{N}p_i\\ 1=p_1 $$

But:

$$ p_i\in P\\ 1\notin P $$

Thus this is not yet the full answer; there is still some work to do.

$\endgroup$
  • $\begingroup$ The hint is not entirely mathematically correct; it is meant to point you in the right direction... $\endgroup$ – Conor O'Brien Jul 19 '15 at 21:56
  • $\begingroup$ @Cᴏɴᴏʀ I believe that is exactly what I said. $\endgroup$ – 2012rcampion Jul 19 '15 at 21:56
  • $\begingroup$ @2012rcampion: I spoilerized the code block for you. Basically, it just needs a >! <pre> at the beginning and a >! </pre> at the end. $\endgroup$ – GentlePurpleRain Jul 20 '15 at 14:38
2
$\begingroup$

@John Stevens was so close to the answer. A Baumic number is defined as such:

Let $T(a)$ be the prime factor tree of $a$, where the left branch of each node is the lowest prime factor of the node.

Example: Let's calculate $T(105)$:

 105
 / \
3  35
   /\
  5  7

This tree “contains” the folowing “elements”: $105$, $3$, $35$, $5$, and $7$. So the following statements are true: $105\in T(a)$, $3\in T(a)$, …, $7\in T(a)$.

A number $a$ is Baumic if and only if there is some element of this tree that numbers the elements in the tree. I.e.: $$B(a)\iff\exists b\in T(a)\left[b=||T(a)||\right]$$

Example: Let's see if $B(105)$. We have that $||T(105)||=5$. Since $5\in T(105)$, $105$ is Baumic.

But what about the false positive, $176$? Let's look at $T(176)$:

 176
 / \
2  88
   /\
  2  44
     /\
    2  22
       /\
      2  11

As can be seen, $||T(176)=9||$. Since $9\notin T(176)$, $\neg B(176)$.

As for the missed numbers, $108$ and $162$:

 108
 / \
2   54
    /\
   2  27
      /\
     3  9
       / \
      3   3

-------------

 162
 / \
2   81
    /\
   3  27
      /\
     3  9
       / \
      3   3

Both trees have a cardinality of $9$, and both contain $9$. Therefore, they are both Baumic.

FUN FACT: Baum is German for Tree. I called them that so that you might think of a factorization tree and thus get the answer.

Another fun fact: All of the following are Baumic numbers, $1-1000$:

1, 6, 9, 15, 20, 21, 30, 33, 39, 45, 50, 51, 56, 57, 69, 70, 72, 75, 84, 87, 93, 105, 108, 110, 111, 123, 125, 126, 129, 130, 140, 141, 159, 162, 165, 170, 175, 177, 183, 189, 190, 195, 196, 201, 210, 213, 219, 230, 237, 243, 245, 249, 255, 267, 275, 285, 290, 291, 294, 303, 308, 309, 310, 315, 321, 325, 327, 339, 345, 350, 352, 364, 370, 381, 385, 393, 410, 411, 417, 425, 430, 435, 441, 447, 453, 455, 462, 465, 470, 471, 475, 476, 489, 490, 501, 519, 525, 528, 530, 532, 537, 543, 546, 555, 573, 575, 579, 590, 591, 595, 597, 605, 610, 615, 633, 644, 645, 665, 669, 670, 681, 686, 687, 693, 699, 705, 710, 714, 715, 717, 723, 725, 730, 735, 753, 770, 771, 775, 789, 790, 792, 795, 798, 805, 807, 812, 813, 819, 830, 831, 832, 843, 845, 849, 868, 875, 879, 880, 885, 890, 910, 915, 921, 925, 933, 935, 939, 951, 960, 966, 970, 993, 1005, 1010, 1011, 1015, 1025, 1029, 1030, 1036, 1041, 1045, 1047, 1059, 1065, 1070, 1071, 1075, 1077, 1078, 1085, 1090, 1095, 1101, 1105, 1119, 1130, 1137, 1148, 1149, 1155, 1167, 1175, 1185, 1188, 1190, 1191, 1197, 1203, 1204, 1218, 1225, 1227, 1232, 1235, 1245, 1248, 1257, 1263, 1265, 1270, 1274, 1293, 1295, 1299, 1302, 1310, 1316, 1317, 1320, 1325, 1329, 1330, 1335, 1347, 1365, 1370, 1371, 1383, 1389, 1390, 1401, 1435, 1437, 1440, 1445, 1449, 1455, 1461, 1473, 1475, 1484, 1490, 1495, 1497, 1505, 1509, 1510, 1515, 1525, 1527, 1545, 1554, 1563, 1569, 1570, 1595, 1605, 1610, 1615, 1617, 1623, 1630, 1635, 1641, 1645, 1652, 1666, 1670, 1671, 1675, 1689, 1694, 1695, 1705, 1707, 1708, 1713, 1715, 1722, 1730, 1731, 1761, 1775, 1779, 1782, 1785, 1790, 1797, 1803, 1805, 1806, 1810, 1821, 1825, 1827, 1839, 1848, 1851, 1855, 1857, 1862, 1872, 1876, 1885, 1893, 1905, 1910, 1911, 1923, 1925, 1929, 1930, 1936, 1941, 1953, 1955, 1959, 1965, 1970, 1974, 1975, 1977, 1980, 1983, 1988, 1990, 1995, 2002, 2015, 2019, 2030, 2031, 2035, 2044, 2049, 2055, 2065, 2073, 2075, 2080, 2085, 2103, 2110, 2127, 2135, 2157, 2160, 2170, 2181, 2185, 2199, 2200, 2212, 2217, 2225, 2226, 2229, 2230, 2235, 2253, 2254, 2255, 2265, 2270, 2271, 2275, 2283, 2288, 2290, 2307, 2319, 2324, 2330, 2331, 2345, 2355, 2361, 2365, 2366, 2390, 2391, 2401, 2405, 2410, 2415, 2425, 2427, 2433, 2445, 2463, 2465, 2469, 2478, 2481, 2485, 2487, 2492, 2499, 2505, 2510, 2517, 2525, 2541, 2555, 2559, 2562, 2570, 2571, 2575, 2577, 2583, 2585, 2589, 2590, 2595, 2618, 2630, 2631, 2635, 2643, 2645, 2649, 2661, 2665, 2673, 2675, 2685, 2690, 2695, 2709, 2710, 2715, 2716, 2721, 2725, 2733, 2755, 2757, 2765, 2770, 2772, 2787, 2793, 2795, 2808, 2810, 2811, 2814, 2823, 2825, 2828, 2830, 2841, 2842, 2859, 2865, 2870, 2884, 2895, 2901, 2904, 2905, 2912, 2913, 2915, 2926, 2930, 2931, 2945, 2949, 2955, 2961, 2970, 2973, 2975, 2982, 2985, 2991, 2992, 2996, 3003, 3010, 3027, 3038, 3039, 3045, 3052, 3055, 3057, 3063, 3066, 3070, 3080, 3093, 3094, 3099, 3110, 3115, 3117, 3120, 3130, 3145, 3147, 3153, 3164, 3165, 3170, 3175, 3183, 3185, 3189, 3207, 3240, 3245, 3255, 3261, 3273, 3275, 3279, 3290, 3291, 3300, 3309, 3310, 3318, 3325, 3327, 3335, 3339, 3344, 3345, 3351, 3355, 3369, 3370, 3381, 3387, 3395, 3405, 3425, 3432, 3435, 3445, 3453, 3458, 3459, 3470, 3475, 3485, 3486, 3489, 3490, 3495, 3513, 3515, 3530, 3535, 3542, 3543, 3549, 3556, 3561, 3565, 3579, 3585, 3590, 3603, 3605, 3615, 3626, 3639, 3651, 3655, 3668, 3669, 3670, 3685, 3687, 3693, 3710, 3711, 3717, 3725, 3730, 3738, 3745, 3747, 3765, 3773, 3775, 3777, 3790, 3815, 3830, 3831, 3835, 3836, 3837, 3843, 3849, 3855, 3867, 3873, 3885, 3890, 3891, 3892, 3895, 3903, 3905, 3909, 3921, 3925, 3927, 3945, 3955, 3957, 3963, 3965, 3970, 3981, 3995, 4010, 4015, 4018, 4025, 4035, 4046, 4048, 4065, 4074, 4075, 4083, 4085, 4090, 4101, 4119, 4130, 4143, 4155, 4158, 4165, 4172, 4175, 4186, 4190, 4197, 4205, 4210, 4212, 4214, 4215, 4221, 4227, 4228, 4235, 4242, 4245, 4255, 4263, 4269, 4270, 4281, 4287, 4299, 4305, 4310, 4312, 4317, 4325, 4326, 4330, 4341, 4345, 4352, 4353, 4355, 4356, 4359, 4368, 4377, 4389, 4390, 4395, 4396, 4413, 4430, 4443, 4445, 4449, 4455, 4459, 4461, 4465, 4466, 4467, 4473, 4475, 4479, 4488, 4490, 4494, 4495, 4497, 4505, 4515, 4522, 4525, 4533, 4557, 4564, 4565, 4569, 4570, 4576, 4578, 4585, 4593, 4599, 4605, 4606, 4610, 4615, 4620, 4629, 4630, 4641, 4647, 4655, 4659, 4665, 4670, 4676, 4677, 4680, 4690, 4695, 4701, 4713, 4715, 4737, 4745, 4746, 4749, 4755, 4774, 4775, 4790, 4791, 4795, 4803, 4805, 4821, 4825, 4827, 4839, 4840, 4844, 4857, 4860, 4863, 4865, 4870, 4881, 4895, 4910, 4911, 4925, 4935, 4945, 4950, 4965, 4970, 4971, 4975, 4977, 4989, 4990, 5001, 5005, 5007, 5012, 5015, 5016, 5030, 5035, 5054, 5055, 5068, 5075, 5079, 5090, 5091, 5097, 5104, 5110, 5127, 5135, 5148, 5163, 5169, 5185, 5187, 5194, 5199, 5200, 5205, 5210, 5215, 5223, 5229, 5230, 5235, 5241, 5259, 5275, 5277, 5278, 5285, 5295, 5313, 5331, 5334, 5335, 5348, 5349, 5361, 5365, 5367, 5385, 5395, 5403, 5404, 5405, 5408, 5410, 5425, 5433, 5439, 5456, 5469, 5470, 5474, 5493, 5495, 5500, 5502, 5505, 5516, 5530, 5541, 5555, 5565, 5570, 5572, 5575, 5583, 5595, 5601, 5605, 5607, 5613, 5619, 5630, 5631, 5635, 5637, 5642, 5665, 5667, 5675, 5685, 5690, 5695, 5698, 5703, 5705, 5710, 5720, 5721, 5725, 5735, 5739, 5745, 5754, 5770, 5782, 5785, 5793, 5795, 5799, 5810, 5825, 5831, 5835, 5838, 5845, 5847, 5853, 5870, 5885, 5908, 5915, 5919, 5929, 5930, 5937, 5945, 5955, 5961, 5975, 5978, 5979, 5990, 5991, 5995, 5997, 6009, 6010, 6015, 6025, 6027, 6033, 6035, 6051, 6055, 6069, 6070, 6072, 6081, 6087, 6095, 6111, 6117, 6118, 6130, 6135, 6159, 6170, 6189, 6190, 6195, 6205, 6207, 6215, 6230, 6235, 6237, 6243, 6244, 6249, 6258, 6261, 6265, 6267, 6275, 6279, 6285, 6297, 6305, 6310, 6314, 6315, 6318, 6321, 6333, 6335, 6339, 6342, 6355, 6356, 6363, 6365, 6387, 6393, 6405, 6410, 6411, 6412, 6423, 6425, 6429, 6430, 6459, 6465, 6468, 6470, 6475, 6483, 6489, 6495, 6512, 6517, 6524, 6528, 6530, 6534, 6537, 6545, 6552, 6565, 6566, 6575, 6585, 6590, 6594, 6609, 6610, 6621, 6622, 6639, 6645, 6663, 6665, 6685, 6692, 6695, 6699, 6711, 6715, 6717, 6725, 6729, 6730, 6732, 6734, 6735, 6741, 6745, 6748, 6753, 6755, 6770, 6775, 6776, 6783, 6785, 6790, 6801, 6807, 6815, 6819, 6830, 6843, 6845, 6846, 6855, 6861, 6864, 6867, 6879, 6891, 6895, 6902, 6909, 6910, 6915, 6925, 6927, 6930, 6933, 6935, 6945, 6955, 6958, 6965, 6985, 6999, 7005, 7007, 7010, 7014, 7015, 7017, 7020, 7023, 7025, 7028, 7035, 7041, 7053, 7055, 7070, 7071, 7072, 7075, 7085, 7090, 7105, 7113, 7119, 7131, 7143, 7149, 7154, 7161, 7167, 7175, 7179, 7185, 7190, 7196, 7197, 7205, 7210, 7216, 7233, 7238, 7251, 7260, 7266, 7269, 7270, 7280, 7285, 7290, 7305, 7311, 7315, 7323, 7325, 7330, 7341, 7345, 7364, 7365, 7377, 7378, 7385, 7390, 7401, 7406, 7419, 7425, 7430, 7431, 7455, 7462, 7480, 7485, 7490, 7505, 7509, 7510, 7518, 7524, 7525, 7532, 7535, 7545, 7563, 7565, 7568, 7570, 7581, 7585, 7588, 7593, 7595, 7602, 7610, 7617, 7629, 7630, 7635, 7645, 7647, 7653, 7656, 7665, 7671, 7675, 7685, 7690, 7700, 7705, 7714, 7722, 7730, 7735, 7737, 7742, 7756, 7773, 7775, 7779, 7791, 7800, 7805, 7815, 7825, 7826, 7827, 7845, 7851, 7863, 7868, 7870, 7885, 7889, 7899, 7904, 7910, 7917, 7924, 7925, 7941, 7945, 7955, 7970, 7971, 7977, 7989, 8001, 8008, 8013, 8015, 8022, 8031, 8049, 8061, 8067, 8079, 8090, 8097, 8106, 8110, 8112, 8115, 8121, 8133, 8134, 8139, 8155, 8157, 8162, 8165, 8184, 8187, 8193, 8195, 8204, 8205, 8210, 8211, 8215, 8223, 8225, 8230, 8245, 8246, 8247, 8250, 8253, 8255, 8259, 8270, 8272, 8274, 8275, 8281, 8290, 8295, 8301, 8305, 8331, 8355, 8358, 8360, 8365, 8367, 8373, 8390, 8391, 8395, 8403, 8405, 8409, 8425, 8435, 8445, 8455, 8457, 8463, 8499, 8511, 8515, 8529, 8530, 8535, 8547, 8553, 8554, 8555, 8565, 8570, 8571, 8580, 8583, 8585, 8590, 8596, 8630, 8631, 8635, 8637, 8645, 8655, 8661, 8673, 8675, 8691, 8695, 8708, 8709, 8715, 8722, 8725, 8727, 8751, 8755, 8757, 8764, 8770, 8781, 8785, 8805, 8806, 8810, 8815, 8817, 8825, 8830, 8845, 8855, 8859, 8862, 8870, 8871, 8876, 8889, 8890, 8895, 8905, 8907, 8913, 8965, 8967, 8975, 8985, 8995, 8997, 9003, 9015, 9033, 9035, 9057, 9065, 9069, 9070, 9085, 9086, 9095, 9105, 9108, 9110, 9111, 9123, 9145, 9147, 9163, 9170, 9175, 9177, 9183, 9185, 9190, 9195, 9201, 9205, 9215, 9237, 9245, 9249, 9255, 9265, 9267, 9268, 9275, 9285, 9290, 9317, 9325, 9327, 9328, 9338, 9345, 9357, 9363, 9366, 9370, 9387, 9394, 9410, 9411, 9415, 9436, 9455, 9465, 9470, 9471, 9475, 9477, 9485, 9489, 9501, 9506, 9507, 9513, 9515, 9530, 9534, 9543, 9545, 9561, 9568, 9573, 9575, 9590, 9595, 9605, 9609, 9615, 9618, 9627, 9635, 9645, 9646, 9651, 9663, 9670, 9685, 9687, 9695, 9702, 9705, 9710, 9715, 9716, 9725, 9728, 9730, 9753, 9758, 9759, 9768, 9770, 9771, 9772, 9777, 9785, 9786, 9792, 9795, 9801, 9805, 9813, 9815, 9828, 9830, 9835, 9842, 9845, 9849, 9884, 9885, 9891, 9897, 9898, 9903, 9905, 9910, 9915, 9921, 9925, 9933, 9939, 9947, 9955, 9957, 9969, 9970, 9982, 9987, 9993.


Edit

As per request, I am posting the code. It coded in JavaScript, and uses recursive traversal and definition methods.

function NumberError(msg){
    this.name = "NumberError";
    this.msg = msg|"";
}

NumberError.prototype=Object.create(Error.prototype);
NumberError.prototype.constructor=NumberError;

Array.prototype.bigUnion = function(){
    var a=[];
    for(var z=0;z<this.length;z++)a=a.concat(this[z]);
    return a;
}

function s(x){
    for(var i=2;i<=Math.sqrt(x);i++) if(!(x%i)) return i;
    return x;
}

function l(x){// largest divisor of x
    for(var i=Math.ceil(Math.sqrt(x));i>=2;i--) if(!(x%i)) return x/i;
    return x;
}

function isPrime(x){
    return s(x)==x;
}

var memoized = [];

function isB(x){    // Baumic number check
    if(memoized[x]) return memoized[x];
    memoized[x]=(new Tree(x)).isB();
    return memoized[x];
}

function Tree(x,f1=s){
    this.top = new node(x);
    var i=0;
    var c=this.top;
    while(!isPrime(c.body)){
        c.attach(f1(c.body),c.body/f1(c.body));
        c=c.children[1];
    }
}

Tree.prototype.disp = function(){
    return this.top.disp();
}

Tree.prototype.isB = function(){
    var yF=this.family();
    return!!(yF.indexOf(yF.length)+1);
}

Tree.prototype.family = function(self){
    return this.disp().replace(/ => \(/g,",").replace(/\)/g,"").split(",").map(Number);
}

function node(x){
    if(isNaN(parseInt(x))) throw new NumberError("Input ("+x+") not a number")
    this.body = x;
    this.children = [];
}

function nodify(type,input,z){
    switch(type){
        case "array":
            return input.map(function(e){return e?z?(new node(e)).factor():new node(e):""});
        break;
        default:
            return new node(input);
        break;
    }
}

function n(input){
    return input.map(function(e){return (new node(e)).factor()});
}

node.prototype.disp = function(){
    return this.body + (this.children.length?" => ("+this.children.map(function(e){return e?e.disp():"?"})+")":"");
}

node.prototype.right = function(){
    if(this.children.length) return this.children[1].right();
    return this.body;
}

node.prototype.attach = function(){
    a = Array.from(arguments);
    for(var _i=0;_i<a.length;_i++){
        y=a[_i];
        if(!(y instanceof node)) try {y=new node(y)}catch(e){if(e instanceof NumberError)throw Error("Invalid node")}
        this.children.push(y);
    }
}
var g=0;
node.prototype.factor = function(f=l){
    ui=[f(this.body),this.body/f(this.body)];
    if(!isPrime(this.body)){
        nu=n(ui);
        console.log(ui,this.body,nu)
        this.children = nu;
    }
}
$\endgroup$
  • $\begingroup$ did you use Java for this? Any chance you could post code if you still have it? I'm quite happy to post Mathematica cade if you want too :) $\endgroup$ – martin Aug 2 '15 at 9:11
  • 1
    $\begingroup$ @martin No, but I did use java_script_. I will post the code in this answer ;) What is Mathematica cade? $\endgroup$ – Conor O'Brien Aug 2 '15 at 21:16
  • 1
    $\begingroup$ @martin I planned originally for a second class of Baumic numbers, so there remains some redundant code in the program. $\endgroup$ – Conor O'Brien Aug 2 '15 at 21:19
  • 1
    $\begingroup$ Thanks for that - I'm trying to expand my languages to Java, Sage, etc. so really helpful to see your method :) Mathematica code I used is as follo0ws, though iots probably not optimal (computes first million in about 60 sec.) - but you caould always go to _Mathematica_SE to ask about optimisation ... baum[nn_] := With[{aa = Flatten[ConstantArray[#[[1]], #[[2]]] & /@ FactorInteger[nn]]}, With[{bb = Table[Times @@ Take[#, k] &@Reverse@aa, {k, 2, Length@aa}]}, With[{cc = Flatten@{aa, bb}}, MemberQ[cc, Length@cc]]]]; Select[Range@1000, baum@# == True &] $\endgroup$ – martin Aug 3 '15 at 0:09
  • 1
    $\begingroup$ yes, very short - think its the 'factor integer' that is taking the time. Thanks again :) $\endgroup$ – martin Aug 3 '15 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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