Q on PARI: analog of IntegerDigits

Gottfried Helms Annette.Warlich at t-online.de
Mon Nov 19 14:47:04 CET 2007


Am 19.11.2007 11:13 schrieb zak seidov:
> Cry for help:
> 
> Is there in PARI an analog of MATHEMATICA's
> 
> IntegerDigits[1123]={1,1,2,3}?!
> 
> Thanks!
> Zak
digits(n,siz=0)=local(st,lae);st=Vecsmall(Str(n)); \
 if(siz==0,lae=length(st),lae=min(length(st),siz));return(vector(lae,k,st[k]-48))

digits(12345)
 %119 = [1, 2, 3, 4, 5]

Gottfried






More information about the SeqFan mailing list