Ruud H.G. van Tol on Sat, 24 Dec 2022 18:17:24 +0100

 veccount

• To: pari-users@pari.math.u-bordeaux.fr
• Subject: veccount
• From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
• Date: Sat, 24 Dec 2022 18:16:13 +0100
• Delivery-date: Sat, 24 Dec 2022 18:17:24 +0100
• Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1671902174; bh=w8+ad74DoZpDCUOKKaklnbvrMPu3/YDZ+kOFJNTSB/A=; h=Date:To:From:Subject:From; b=gWwgYyIFptuw6+ifCIOQ3XgrCKPA9CZFM2ympQ+EdxvLx1oWPKL1wNmwOpt6ckaFG NK2pV8lZpX+hCzTSYRifVGlX0AkSDUAxDXZnqYHaIM3S/PuGS4/SoqrZdt+nyru0BK Jzi/Iux2UaDfP4sE7ke8KAFiFXPF5cbgAaogJDSefJQZHsVo3usYqFuXEIsDrWl2k6 y3k+EEk3TxbuAhKEzPait+SOb3Xe7BZU2MMYgWQ5vZM9EWs/BxmYALUdv9QvEe5Q1k 1NCoYTofpkuRrRe3t7rz8VvV6Tntz5HN5BlBrsPINxyi8+PW75IYOFNvHjguv7HXem EtHAMCvhJ3vOw==

```
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]
```

-- Ruud

```

• Follow-Ups:
• Re: veccount
• From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>