Re: Counting digit in other base
- --- In email@example.com, Alan Eliasen <eliasen@...> wrote:
> On 11/08/2010 04:03 PM, djbroadhurst wrote:
> > Videlicet: How many 7's are there in the largest known prime,
> > when the latter is written in base 137?
> > David (who has no idea, but might be told, eventually)
> It would be nice to get an answer to this, and edifying to people
> interested in the problem to see what the bottlenecks are. The number
> itself, 2^42643801-1, can be calculated with Java (with my patches)
I've been running a pfgw script to answer David's question using the above 2^42643801-1 for the past 24 hours.
I just noticed I should instead be using 2^43112609-1.
As it appears Kevin will soon have the answer I will not start a second attempt, at least for the time being.
> milliseconds (without my patches, several days. It's only a left-shift
> and a subtract, both of which can be done in small O(n) time.)
> Converting the radix in native Java will take days and days. Even
> though it has fast operations for bitCount, that's not much help here.
> (Even I can do in my head that there will be 42643801 ones and no
> zeroes, if we only want the binary digits). Scanning the final number
> for sevens can be done in milliseconds.
> (My wild estimate, which I may have bungled, is 43853 sevens in the
> Alan Eliasen
- At 07:58 PM 18/11/2010, Christ van Willegen wrote:
>On Thu, Nov 18, 2010 at 9:47 AM, Di Maria GiovanniYou will find, just as in Peter's original script, that the count of
> > Thank you very much.What'is the sintax of this function c(n,b,v)
>It looks like you should be able to call it like:
>IIRC it will return a vector with digit counts for all the digits 0..b-1
>Christ van Willegen
zeros has been left as an exercise for the reader.