Ruud H.G. van Tol on Wed, 29 Jan 2025 15:35:45 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: 2^[1,3]
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Date: Wed, 29 Jan 2025 15:24:02 +0100
- Delivery-date: Wed, 29 Jan 2025 15:35:45 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1738160643; bh=pqlbKQtTbNTGXm/fmjj8a5d35MCsPeRqv2X7EoAoySQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=GpcATSvWN7E/w9ydt0WTQHKo+NQhklgivW+r23t8qIMIVrpGLhf1kBWeYJC6MVjRk ADNWvB4/J8GPFRQ1327+8f+zxvk4bUjbbHhLgEd7bmUlTzt8SiYQMXRaGIhVS5MRkh V/ctcGP7DPbLkBZwmfuaWD1t1NZDE691WHwmISnDUJQkzrnmg9Y9istVXGjpiaxlIa z9rJktuw2m9REUx8dLDDgjrmmwtMyCGZ5DMbAMUUUrMr2+DcfgsNxkLPWXKuWR5oAz iaGEvTrpGFso0BevTirLzKZrfxHnyvK+B4RAAVByMEximI5RgPbvnVzGyS946Ccjbh eLckAxMH1K8ig==
- In-reply-to: <Z5owN4oJqB1X4pAA@seventeen>
- References: <d43e2330-fb29-4889-8a13-b90b99dd7f01@isolution.nl> <Z5owN4oJqB1X4pAA@seventeen>
On 2025-01-29 14:42, Bill Allombert wrote:
> On Wed, Jan 29, 2025 at 02:28:46PM +0100, Ruud H.G. van Tol wrote:
>> ? vecsum(2^[1,3])
>> % 10.000000000000000000000000000000000000
>
> Use fromdigits:
> ? fromdigits([1,3],2)
> % = 10
Doesn't work:
? fromdigits([1,3],2)
% = 5
(because 1*2^1 + 3*2^0 = 2+3 = 5)
The (distinct) digits are exponents, are not positional.
2^1 + 2^3 = 10.
Example quest:
>> How to best convert something like (int) 6131786 to (int) 2^1 + 2^3
+ 2^6 +
>> 2^7 + 2^8?
>
> You can use the binary() function.
I don't see yet how.
-- Ruud
- Follow-Ups:
- Re: 2^[1,3]
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- References:
- 2^[1,3]
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Re: 2^[1,3]
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>