2^[1,3]

"Ruud H.G. van Tol" <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
? 2^[1,3]
% [2.0000000000000000000000000000000000000, 
8.0000000000000000000000000000000000000]

? vecsum(2^[1,3])
% 10.000000000000000000000000000000000000

? vecsum([ 1<<e |e<-Set(digits(131)) ])
% 10


I wonder why 2^[1,3] uses reals.

- - - - -

How to best convert something like (int) 6131786 to (int) 2^1 + 2^3 + 
2^6 + 2^7 + 2^8?
(to be used as a Map-key)

-- Ruud

Example usage:

A096779_list(N) = {
   my(m(n)=vecsum([1<<e|e<-Set(digits(n))]), u=Map(), s=vector(2^10), 
v=vector(N));
   for(i=1, N
   , my(t=m(i), r=s[t]+1);
     while( bitand(t, m(r)) || mapisdefined(u, r), r++);
     mapput(~u, r, 0);
     s[t]=v[i]=r
   );
   v
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.