Nope. As you see from the code it does not call `is_prime_power` but the fact that the factorization has length one... the error is right ! There is no way to guess what is your prime if you feed the big O with 1... (Python first evaluates 7^0 of course).
One dirty way to obtain the big O as you wanted is sage: o1 = O(7) sage: o1.add_bigoh(0) O(7^0) but there might be better ways. Vincent 2014-09-02 18:59 UTC+01:00, Bill Hart <[email protected]>: > Is this a possibly related issue: > > sage: O(7^0) > --------------------------------------------------------------------------- > ArithmeticError Traceback (most recent call last) > <ipython-input-1-85f5f0a44709> in <module>() > ----> 1 O(Integer(7)**Integer(0)) > > /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/rings/big_oh.pyc > > in O(*x) > 84 F = arith.factor(x) > 85 if len(F) != 1: > ---> 86 raise ArithmeticError("x must be prime power") > 87 p, r = F[0] > 88 if r >= 0: > > ArithmeticError: x must be prime power > > > On Tuesday, 2 September 2014 17:02:45 UTC+2, John Cremona wrote: >> >> On 29 August 2014 12:32, Simon King <[email protected] <javascript:>> >> wrote: >> > Hi John, >> > >> > On 2014-08-29, John Cremona <[email protected] <javascript:>> wrote: >> >> 1 is definitely not a prime power. >> > >> > OEIS says it is: http://oeis.org/A000961 >> >> Not any more: http://oeis.org/A246655. The OEIS now distinguishes >> between "prime powers" and "powers of primes". >> >> John >> >> > >> >> It's basically the same reason that 1 >> >> is not a prime. >> > >> > It's basically the same reason that the empty product evaluates to 1. >> > >> > Best regards, >> > Simon >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "sage-devel" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to [email protected] <javascript:>. >> > To post to this group, send email to [email protected] >> <javascript:>. >> > Visit this group at http://groups.google.com/group/sage-devel. >> > For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "sage-nt" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send an email to [email protected]. > Visit this group at http://groups.google.com/group/sage-nt. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-nt" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. Visit this group at http://groups.google.com/group/sage-nt. For more options, visit https://groups.google.com/d/optout.
