Igor Schein on Thu, 02 Jun 2011 00:55:07 +0200
[
Date Prev
] [
Date Next
] [
Thread Prev
] [
Thread Next
] [
Date Index
] [
Thread Index
]
binary() generalization
To
:
pari-users@list.cr.yp.to
Subject
: binary() generalization
From
: Igor Schein <
igorschein@gmail.com
>
Date
: Wed, 1 Jun 2011 18:48:09 -0400
Hi,
I am looking for an efficient generalization of gp's binary() function.
digits(n,b)=local(m=n,L=List);while(m,v=divrem(m,b);listinsert(L,v[2],1);m=v[1]);
It's very inefficient compared to the native function:
? for(k=10^5,10^6,digits(k,2))
time = 18,749 ms.
? for(k=10^5,10^6,digits(k,10))
time = 6,401 ms.
? for(k=10^5,10^6,binary(k))
time = 236 ms.
Can I do better than that?
Thanks
Igor
Follow-Ups
:
Re: binary() generalization
From:
Charles Greathouse <charles.greathouse@case.edu>
Re: binary() generalization
From:
Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>
Prev by Date:
Re: Multiple Summation Question
Next by Date:
Re: binary() generalization
Previous by thread:
RE: Multiple Summation Question
Next by thread:
Re: binary() generalization
Index(es):
Date
Thread