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
Delivery-date
: Thu, 02 Jun 2011 00:55:07 +0200
Dkim-signature
: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=rjotEJbTAZanKToOabbcagHr3sNPrzMvEgoQNJSGzbY=; b=NCJSFVth7STqBFL1BUrB9+uhz8mAIrWoRSESdsi19EzXit61vp809wGzaBnctCbfZy EBjYiYemqh9IJX36BmGuVsCU4q45sUridxB8m0I6GYiFwjQtEhYrG5K682d8x280DAVv 3VxZhc0agqiUoTzHntffjc/u3gwEz7u0JrWKc=
Domainkey-signature
: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=xRlZgYMy6eF4tTZ82kubMQtbfKdSzYvbk7RNEXlRlGQXD7DNGjlt7HKf2LwLjQkCTl B/Jdor+CB2ZzCYOu5WFh4enZDGJXCQ9v5AAXun5SQvwCrDgH7SLDClaq73kflgG7u0Kz EmqqeUCppj53O+ABnof2Zum2c+F0L4oY6uWfE=
Mailing-list
: contact
pari-users-help@list.cr.yp.to
; run by ezmlm
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