Re: [math-fun] Reminder: FactorInteger@1 is {{1, 0}}, or better yet: {}!
On 2017-12-29 15:22, Fred Lunnon wrote:
<< Can Maple be this stupid? >>
Mathematica? WFL
No, I meant can Maple be as stupid about this as Mathematica, hoping that someone would try it. (Also in whatever other computer algebras they had.) The answer is apparently "No, at least one Maple function gets it right:" ifactors(1) gives [1,[]] (https://www.maplesoft.com/support/help/Maple/view.aspx?path=ifactors) where the first slot is the sign -1, 0, or 1. So it can even be logical about 0. Hey, here's an idea: FactorInteger[1] -> {{0,0}}. That should make Knuth happy! It's consistent with FactorInteger[0] -> {{0,1}} Maple's is the only scheme where only primes appear in the pairs list. But they still botch binomial: In the case that n is a negative integer, binomial(n,r) is defined by this limit. If r is a negative integer, by the symmetry relation binomial(n,r) = binomial(n,n-r), the above limit is used. In the case that exactly two of the expressions n, r, and n−r are negative integers, Maple also signals the invalid_operation numeric event, allowing the user to control this singular behavior by catching the event. Adam Goucher privately remarked
[FactorInteger@1] should definitely be {}, so as to preserve the property that Length@FactorInteger gives you the number of distinct prime factors. --rwg
On 12/29/17, Bill Gosper <billgosper@gmail.com> wrote:
Either that, or 1 is a prime number: In[375]:= Cases[FactorInteger@Range@22, {{p_, 1}} -> p]
Out[375]= {1, 2, 3, 5, 7, 11, 13, 17, 19}
In[376]:= FindSequenceFunction@%
Out[376]= FindSequenceFunction[{1, 2, 3, 5, 7, 11, 13, 17, 19}]
In[377]:= FindSequenceFunction@Rest@%%
Out[377]= Prime
You should be embarrassed for all the damage to young students. Who might well ask: Why isn't it {{1,69}}?
Can Maple be this stupid? Does it matter? €2,700.00 + €540.00 regular yearly upgrade ??
Macsyma: (c1) MAKELIST(FACTOR_NUMBER(N),N,1,9);
1 1 2 1 1 1 1 3 2 (d1) [[], [2 ], [3 ], [2 ], [5 ], [2 , 3 ], [7 ], [2 ], [3 ]]
(c2) BLOCK([FANCY_DISPLAY : FALSE],PLAYBACK([1,2])); --Bill
participants (1)
-
Bill Gosper