Karim Belabas on Sat, 24 Dec 2022 18:24:37 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Subject: Re: veccount
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Sat, 24 Dec 2022 18:23:13 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1671902590; c=relaxed/relaxed; bh=YLIN0buD3lIxzz4dcVgOd7vRU2ujAMXcI7HApDZ+c0w=; h=DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=VRL+x6ukdEx+6eRJZXv1EdC26NTdUu4aLtuC2cdJGZAznTSOfte2sHA0NPcWfndb13RG8yy5L0w4fD789Lvv8CRamrVpoC96Ahd0RmEAIIvtY5gsnPY3QTfk8Hk/gutNQaCcIuBN2HllgN4o81v+lRSVobZQGElTA6wiVeTz1Js6lthYKSqiF6Q3J8CiFwinSrGN33t0Y1RAu+1bfbEYJILmVmVQai5WsGATookpVVgVUS0/MChxp3grpeJIFFK7tvwj5fqJxS6xUP/Ii6BPIBiUqZez1xWNS2rsTjLodmK0tKeTFq5Z0d2m47WxBgreHxek6UpyFSr439CeCEdfcZs8u/VRjql3vVlc198cI2wcRQFr9c9BowgTAWHmXIUpGWkueU1ik0Cu+pmERxWsNs4T+oYboaoWQIv1QbGjCmdmduzoxTYMBaNUXaCHJfPMkGHXNvXmZrjxpp44IPnZ08PRaw/bNzhd5dSdvBYgVmNN4tdAo+VBhb/5jO5ifO4cK+o46id8/6BTr3z/4GcgGran5t/kmLybF1l5eBoQSlotqpnf8w4IG3bVwMPmP/5TKPofOZPbO6hVFbyKXTcU0pOty1p+STipJTs/DxjMCRLghY+SzbGzpk+amLDc47vDKfcagvIq22rv0yDUWapMX5zWJ0Wv2Qad3W544IS/3fk=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1671902590; cv=none; b=Qh5Uti3bHL0Vg4yrSo4ylOnchxoIrNzZ4Ydaov/DCvzt7a56sEn2AMxO/ByiTwYPsl6kkkb9PPCZKiZCW6TKf1bQ9YmrCGtArHRWtTWsKuxqZ2cjhbUABfF6G3gT5LFOe02stZ2K8ABEUUAmn0V4pSQ6/igW9CXq8ewaO7kFHNYJoOHuRks+bKK27AYHqsmn+OKcBiN0b0Okv1pBgnCsZ9qAoNP0LSn8OMhKiOdc3PMgWViQkJANcpR6pQfTaXXft2J137B1Txo1MTFGmx+V9/O5oMFlXqxuGt3KUMnBgJ268aS4V3SEHUPsUOexGzpzZS3GMq7NFo/EEEbVM9zu8oJI1F/j+H6CrhauTlKxE4mMMTlfIbJKB5qT1sDWFOwc184ZdK5hXD09kt1mDqzo5tmLucYcxs7GAdtiln2SxE0fO3Mm1ZpY1M2ANJvlvc6GqNAAoV3HP+ujDBJVj/BHNB3P3Cxtm0qX+7nuivH1w1Fg7i1nqKAM9dL6kETXmcJ7DE6O2P9UnNfW8z8cAk0Gq+BcWf9kdjevPpDp3orJ859LWf0F+MYaTw+9p0y9tq6RnuEky40dH9MnhNgZtlUPuMR8CITFDbNy0e7wfCvzeBmDN2H/CpDzTeAmN4braikP0ddhKX8PxHzfcazaR6lIjfWo7ysrPtTl3DUU9UzCw/g=
- Authentication-results: smail; arc=none
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Sat, 24 Dec 2022 18:24:37 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1671902590; bh=YLIN0buD3lIxzz4dcVgOd7vRU2ujAMXcI7HApDZ+c0w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OiJHHgpZYe2EIP2whN6KdE8j6hvT8Jco90Se7txYY4LkkxeoFr1Y9RUjEBskp5Rht TTw2bGnQOfVx6y8PWEEBugbNrrln2IFDPSZKDJ68vKAedYgQCjYvkBF2/adCeuDOCO uO6F6ShE/3feJM6PbexNNh/kM2uMvzbjtuhzelMYMAQcVmuJ/0Lg7tgdvljPOaTT6s 7MLFgl8Vetpmw1fjsxNWirNdoTdNFiVhdJfUluP6qiYRE7QcmorSqjm8Xl3C2r7+K1 HOSzk/MCz6fIVn1IZzEBbJAkAerNIohlHWUnBQN0HVeabxAaC1qOv09OG7JbZzacQ0 YrjZS/U/BHlnBn+dJMz05cZF4ehldT7029U13k6B9lSTo2hDpHnzMDP4EG8Cime/vg O83Le+oMzsDuN0fh+36lPqVi6p8QBNwe2xQkIdvOoyD516pLjvWKl+eQTlqlsVLGwP A9qslECxLiHKi3Hml56rsOT7gvI3dSryVV9yY0cQTrCsMEWNv+aiSjfNRKe0RVxjck 0Wmsqj1s++Ry1TLV58oy8G2/9OGgvUZQLTtjz0IHtqT8xeYt7Hivojj9FiIQYiDQxM 5PSDu4BHrhgv3PzlZDrUOwCQRZlOIqYz8dvr5+xaYOflfPn5N4bu2uMGwd77DofvwP Y9td/gaY3p71TeU4u9J3rAPI=
- In-reply-to: <cf98b55d-d32b-60c6-6781-a658f2f57e5c@isolution.nl>
- Mail-followup-to: "Ruud H.G. van Tol" <rvtol@isolution.nl>, pari-users@pari.math.u-bordeaux.fr
- References: <cf98b55d-d32b-60c6-6781-a658f2f57e5c@isolution.nl>
* Ruud H.G. van Tol [2022-12-24 18:16]:
>
> Is there a more canonical way to do runlength-counting?
>
> { my(count(v)=
> my(a=List(),c=1);for(i=1,#v-1,if(v[i+1]==v[i],c++,listput(a,c);c=1));Vec(a));
> print(count([logint(2^i,3)|i<-[0..98]]));
> }
> [2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1,
> 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2,
> 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1]
? v = [logint(2^i,3)|i<-[0..98]]
%1 = [0, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 47, 48, 49, 49, 50, 51, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 59, 60, 61, 61]
? matreduce(v)~
%2 =
[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61]
[2 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 2]
Cheers,
K.B.
--
Karim Belabas / U. Bordeaux, vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/
`
- References:
- veccount
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>