This site is supported by donations to The OEIS Foundation.

User talk:Michael De Vlieger

From OeisWiki
Jump to: navigation, search

A235589

I very much appreciate the contribution/correction to my sequence.--Bill McEachen 00:05, 16 September 2015 (UTC)

Bill, the pleasure is mine. I love helping define/refine, generally aiding sequences. I share your love of math and really enjoy the site. It is a very useful resource and am honored to contribute. (Mike)

A194602

Hi Michael,
thanks for the contribution. You have added the following program:
lim = 12; Sort[FromDigits[#, 2] & /@ Map[If[Length@ # == 0, {0}, Flatten@ Most@ #] &@ Riffle[#, Table[0, Length@ #]] &, Map[Table[1, # - 1] &, Reverse@ Map[Sort, Sort@ IntegerPartitions@ lim] /. 1 -> Nothing, {2}]]]
Could you link an example of what exactly Mathematica produces for a small lim like 12? Do you compute the actual sequence or integer partitions in the order defined by this sequence?
Honestly, this program is so short, that it looks too good to be true, because Mathematica seems to use a different order:
Here the partitions of 5 are given as: { {5}, {4,1}, {3,2}, {3,1,1}, {2,2,1}, {2,1,1,1}, {1,1,1,1,1} }
But the order defined in my sequence is totally different: { {1,1,1,1,1}, {2,1,1,1}, {3,1,1}, {2,2,1}, {4,1}, {3,2}, {5} } Greetings, Tilman Piesk 21:54, 11 February 2016 (UTC)

Mr. Piesk, Hello!

Here’s how it works:

We start with the partitions of n = lim via IntegerPartitions. In order to get the partitions in the order you specify at A194602, we have to sort it (and I am not sure it is the best way, but it works). Thus we get:

Reverse@ Map[Sort, Sort@ IntegerPartitions@ n]

(We have to map Sort to the individual lists within the main list, and sort the list of partition sets, then reverse the order once we're done to get it to be the way you want it.) Now for n = 12 we have:

{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 3}, {1, 1, 1, 1, 1, 1, 1, 1, 2, 2}, {1, 1, 1, 1, 1, 1, 1, 1, 4}, {1, 1, 1, 1, 1, 1, 1, 2, 3}, {1, 1, 1, 1, 1, 1, 2, 2, 2}, {1, 1, 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, {4, 8}, {5, 7}, {6, 6}, {12}}

We are not interested in 1’s, so I use ReplaceAll (/.) in this statement: Reverse@ Map[Sort, Sort@ IntegerPartitions@ lim] /. 1 -> Nothing. This simply ignores 1’s. Result:

{{}, {2}, {3}, {2, 2}, {4}, {2, 3}, {2, 2, 2}, {5}, {2, 4}, {3, 3}, {2, 2, 3}, {2, 2, 2, 2}, {6}, {2, 5}, {3, 4}, {2, 2, 4}, {2, 3, 3}, {2, 2, 2, 3}, {2, 2, 2, 2, 2}, {7}, {2, 6}, {3, 5}, {2, 2, 5}, {4, 4}, {2, 3, 4}, {2, 2, 2, 4}, {3, 3, 3}, {2, 2, 3, 3}, {2, 2, 2, 2, 3}, {2, 2, 2, 2, 2, 2}, {8}, {2, 7}, {3, 6}, {2, 2, 6}, {4, 5}, {2, 3, 5}, {2, 2, 2, 5}, {2, 4, 4}, {3, 3, 4}, {2, 2, 3, 4}, {2, 2, 2, 2, 4}, {2, 3, 3, 3}, {2, 2, 2, 3, 3}, {9}, {2, 8}, {3, 7}, {2, 2, 7}, {4, 6}, {2, 3, 6}, {2, 2, 2, 6}, {5, 5}, {2, 4, 5}, {3, 3, 5}, {2, 2, 3, 5}, {3, 4, 4}, {2, 2, 4, 4}, {2, 3, 3, 4}, {3, 3, 3, 3}, {10}, {2, 9}, {3, 8}, {2, 2, 8}, {4, 7}, {2, 3, 7}, {5, 6}, {2, 4, 6}, {3, 3, 6}, {2, 5, 5}, {3, 4, 5}, {4, 4, 4}, {11}, {2, 10}, {3, 9}, {4, 8}, {5, 7}, {6, 6}, {12}}

Thus we have a list of numbers of iterations of 1’s.

This will produce a table of “# - 1” 1’s (# is a “slot” or variable in a pure function): Table[1, # - 1] &. But I need to delimit the table, suppose I have a list like this: {2, 3}, I will get {{1}, {1, 1}} and that would become {1, 1, 1} and end up wrong. So I use Riffle to separate output with a single zero: Riffle[#, Table[0, Length@ #]] &. Now this will give us {{1}, 0, {1, 1}, 0}. We don’t need the last 0, so I use Most to eliminate the last zero. Because I might have an empty list like {}, I have to use an If statement: If[Length@ # == 0, {0}, Flatten@ Most@ #] & to handle those cases. Thus the code now looks like this:

Map[If[Length@ # == 0, {0}, Flatten@ Most@ #] &@ Riffle[#, Table[0, Length@ #]] &, Map[Table[1, # - 1] &, Reverse@ Map[Sort, Sort@ IntegerPartitions@ 12] /. 1 -> Nothing, {2}]]

And output like this:

{{0}, {1}, {1, 1}, {1, 0, 1}, {1, 1, 1}, {1, 0, 1, 1}, {1, 0, 1, 0, 1}, {1, 1, 1, 1}, {1, 0, 1, 1, 1}, {1, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 0, 1}, {1, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1}, {1, 0, 1, 0, 1, 1, 1}, {1, 0, 1, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 0, 1, 0, 1}, {1, 1, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1}, {1, 0, 1, 0, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1}, {1, 0, 1, 1, 0, 1, 1, 1}, {1, 0, 1, 0, 1, 0, 1, 1, 1}, {1, 1, 0, 1, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 0, 1, 0, 1, 1}, {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, {1, 1, 1, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1, 1}, {1, 0, 1, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1, 1}, {1, 0, 1, 1, 0, 1, 1, 1, 1}, {1, 0, 1, 0, 1, 0, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 0, 1, 1, 1}, {1, 1, 0, 1, 1, 0, 1, 1, 1}, {1, 0,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, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}

These are the digits of binary numbers:

{0, 1, 11, 101, 111, 1011, 10101, 1111, 10111, 11011, 101011, 1010101, 11111, 101111, 110111, 1010111, 1011011, 10101011, 101010101, 111111, 1011111, 1101111, 10101111, 1110111, 10110111, 101010111, 11011011, 101011011, 1010101011, 10101010101, 1111111, 10111111, 11011111, 101011111, 11101111, 101101111, 1010101111, 101110111, 110110111, 1010110111, 10101010111, 1011011011, 10101011011, 11111111, 101111111, 110111111, 1010111111, 111011111, 1011011111, 10101011111, 111101111, 1011101111, 1101101111, 10101101111, 1101110111, 10101110111, 10110110111, 11011011011, 111111111, 1011111111, 1101111111, 10101111111, 1110111111, 10110111111, 1111011111, 10111011111, 11011011111, 10111101111, 11011101111, 11101110111, 1111111111, 10111111111, 11011111111, 11101111111, 11110111111, 11111011111, 11111111111}

So we convert them and sort using Sort[FromDigits[#, 2] & /@ ... ]*:

{0, 1, 3, 5, 7, 11, 15, 21, 23, 27, 31, 43, 47, 55, 63, 85, 87, 91, 95, 111, 119, 127, 171, 175, 183, 191, 219, 223, 239, 255, 341, 343, 347, 351, 367, 375, 383, 439, 447, 479, 495, 511, 683, 687, 695, 703, 731, 735, 751, 767, 879, 887, 895, 959, 991, 1023, 1365, 1367, 1371, 1375, 1391, 1399, 1407, 1463, 1471, 1503, 1519, 1535, 1755, 1759, 1775, 1791, 1911, 1919, 1983, 2015, 2047}

  • Note, My original text was an error: "eliminate duplicates using Union[FromDigits[#, 2] &" referred to a second and aborted solution to another sequence. I thought I had erased everything I wrote associated with that second solution but missed this. - MTD 14 Feb 2016]

Michael De Vlieger 23:35, 11 February 2016 (UTC)

Hello and thanks for the detailed explanation. Unfortunately I don't fully understand it, as Mathematica is strange to me.
At the beginning you sort the partitions to bring them in the right order, and then you convert them to integers. Would it not be easier to just convert them in the original order, and then just sort the integers?
I fail to understand how you produce duplicates that have to be removed later ("eliminate duplicates using Union").
All in all I think it would be better to have two separate functions: One that sorts a set of partitions in the order of A194602 without changing them, and one that converts a single partition to a value of A194602.
BTW: The really interesting task is to write functions that convert key numbers of A194602 to values and vice versa. (I have written ugly and slow ones in Python.)
The regularity in the columns of this triangle and the triangles linked from there suggests that a fast function could be written with the help of A026807. I hope I will find time for that soon.
Greetings, Tilman Piesk 16:02, 13 February 2016 (UTC)

Thank you! You know, the approach indeed can be done another way and it might be more efficient the way you specify. The problem is interesting to me and I will return to it, examining it through the lens of A026807. Right now I smoothed out the program, doing as you suggest, processing the partitions "in situ" then sorting them after conversion.
I made a mistake in my explanation. I did not use Union at all in this effort, but instead was attacking a similar sequence you wrote but I hadn't finished because of interruption. Please ignore that (I've noted and corrected it above with an asterisk.)
Here's a new, smoother program:

 lim = 60; 
 Sort[FromDigits[Reverse@ #, 2] & /@ 
   Map[If[Length@ # == 0, {0}, Flatten@ Most@ #] &@ 
     Riffle[#, Table[0, Length@ #]] &, 
     Map[Table[1, # - 1] &, 
       Sort@ IntegerPartitions@ lim /. 1 -> Nothing, {2}
     ]
   ]
 ]

This one processes n = 60 (966467 terms) in 29.3126 s vs. 29.9834 s. Best, Michael De Vlieger 14:16, 14 February 2016 (UTC)

Great. I allowed myself to add that to the sequence (with lim=12), so it is back in status editing. (And I allowed myself to out-indent your answer.) Greetings, Tilman Piesk 17:48, 17 February 2016 (UTC)
I have linked the Python code using A026807 from the sequence. Finally I can compute values from keys and vice versa without creating and ordering a list of partitions. Tilman Piesk 00:13, 29 February 2016 (UTC)
This is is an interesting development and will return to the problem when workload allows. I imagine it is enormously more efficient! Michael De Vlieger 13:55, 29 February 2016 (UTC)

Number bases

My favorite numeral system is balanced ternary. I also like the factorial numeral system (factoradic representation). — Daniel Forgues 17:36, 1 April 2016 (UTC)

Switch around the comma

Hello Michael, (June 10th, 2016) thank you for the Mathematica code you've added here recently https://oeis.org/A274051.

I read here that you like computing sequences -- and I have a challenge for you, as I'm unable to compute anything -- not to say my private life:

A = 1,21,12,32,33,91,14,72,111,15,92,321,301,102,322,721,901,702,931,312,332,942,152,153,74,75,34,93,703,711,121,731,132,762,361,932,972,172,781,141,...

B = 2,11,13,23,29,31,17,41,211,19,53,223,101,103,227,229,107,109,233,113,239,241,251,257,37,43,59,47,307,311,127,131,137,263,269,139,271,277,281,149,...

A is the lexicographically first sequence of non-prime terms [with no duplicates] such that a _simultaneous_ switch of all the pairs of digits in contact with a comma produces a sequence of prime numbers [with no duplicates either] [here B]

Example: 239 (in B) is prime -- it's first digit "2" comes from the final "2" of 312 (above it, left, in A) -- it's end digit "9" comes from the first digit "9" of 942 (above it, right, in A) -- it's central digit "3" comes from the central digit "3" of 332 (immediately above it, in A, unchanged because this "3" of 332 was not in contact with any comma of A).

I've computed both A and B by hand -- and I hope I didn't err too quickly...

I would appreciate if you could check and extend A. If you want to have a go, please keep this in mind:

- the aim is to always extend A with _the smallest_ unused a(n) integer yet that doesn't lead to a contradiction. Even if this a(n) forces a huge a(n+1). A and B are linked, of course -- but the main concern is A, the construction of B follows. Yes, sometimes B forces too one digit or the other in A -- and you will see that some (small) backtracking is needed sometimes in trying to find the next a(n) of A.

Last remark, integers of A never end with a zero, of course (as this zero would start an integer of B -- which is impossible).

Feel free not to answer this or to compute anything, of course -- I'm a bit of an intruder on your page!

Best, _Eric Angelini_ (eric.angelini@skynet.be)


Eric, I am happy to help. Have a few things this weekend and a deadline Monday but after that will take a look! (Mike)


Hello Mike,

Thank you for the quick answer -- in the meantime a friend of mine computed +/- 160 terms (the computer took 36 hours to find those -- my friend stopped the program as it was becoming horribly slow). His list diverges from mine after 37 terms -- and indeed, my 172 (in A), should have been 171. If you still have the courage to check and extend the sequence, please do -- else don't waste time on this! Best, É.

A and B (by Jean-Marc Falcoz): A={1,21,12,32,33,91,14,72,111,15,92,321,301,102,322,721, [deleted -- see link to the OEIS below]

B={2,11,13,23,29,31,17,41,211,19,53,223,101,103,227,229, [deleted -- see link to the OEIS below]


Ok Mike, this is now https://oeis.org/A228092. Best, É.


A347391

Could you please explain how my preprint that you linked from A347391 is relevant to this sequence? - Max Alekseyev (talk) 18:35, 14 March 2023 (EDT)


Dr. Alekseyev, this is perhaps the easiest question in the world to answer! It was a typo in the search. I hit "9" instead of "0" (A347301) shown on page 1 of that paper. So the answer is that it was my mistake. Thanks for catching it! (Mike).

Ok, no problem. That's why I almost never type in sequence ids but rather copy'n'paste them. - Max Alekseyev (talk) 19:36, 14 March 2023 (EDT)