![]() |
|
|
#2003 |
|
Aug 2006
597910 Posts |
|
|
|
|
|
|
#2004 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
http://rosettacode.org/wiki/LZW_compression is described both on wikipedia and a book I own. Doesn't sound too hard, Of course I said that about most things lol.
|
|
|
|
|
|
#2005 |
|
Aug 2006
3·1,993 Posts |
Go for it, then.
|
|
|
|
|
|
#2006 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
according to my book it doesn't concat anything into the library/dictionary until it hits it the second time in a string, also it talks of a simplified case of all upcase I'll have to make the starting dictionary twice as long for both cases and 52 variables to track them through 2 times i guess I must be over complicating things, doh.
|
|
|
|
|
|
#2007 |
|
Aug 2006
3·1,993 Posts |
Maybe try something easier first, then? Perhaps
http://rosettacode.org/wiki/Non-decimal_radices/Input or http://rosettacode.org/wiki/Write_fl...to_a_text_file |
|
|
|
|
|
#2008 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
1)Create 2, 36 index vectors then shorten them for the respective bases. 2)Read a Vec of the number to convert and use the index to add into a decimal form variable. 3)take that decimal form and use variable%b2 to get each index to return later. 4) return it. |
|
|
|
|
|
|
#2009 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
trouble on number 1)
Code:
*** syntax error, unexpected ',': ...mb1,b1,b2)=b1digs["0","1","2","3","4","5","6"
^--------------------
Last fiddled with by science_man_88 on 2010-12-05 at 13:57 |
|
|
|
|
|
#2010 |
|
May 2010
Prime hunting commission.
24·3·5·7 Posts |
Wow. I see we've collected 2000 posts.
|
|
|
|
|
|
#2011 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
I bet if we took out all of the useless ones we'd not even have half that lol.
Code:
convert(numb1,b1,b2)= b1digs=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];b1digs=vector(b1,n,b1digs[n]);b2digs=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];b2digs=vector(b2,n,b2digs[n]);numb1=Vec(Str(numb1));a=0;c=[];forstep(y=#numb1,1,-1,for(x=1,#b1digs,if(numb1[y]==b1digs[x],a=a+(x-1)*b1^(#numb1-y))));until(floor(a/b2)==0,c=concat(b2digs[a%b2+1],c));c; |
|
|
|
|
|
#2012 | |
|
Aug 2006
10111010110112 Posts |
Quote:
Code:
convert(numb1,b1,b2)={
my(B=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],b1digs=vector(b1,n,B[n]),b2digs=vector(b2,n,B[n]),a=0,c=[]);
numb1=Vec(Str(numb1));
forstep(y=#numb1,1,-1,
for(x=1,#b1digs,
if(numb1[y]==b1digs[x],
a=a+(x-1)*b1^(#numb1-y)
)
)
);
until(floor(a/b2)==0,
c=concat(b2digs[a%b2+1],c)
);
c
};
|
|
|
|
|
|
|
#2013 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Quote:
|
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why do I sometimes see all the <> formatting commands when I quote or edit? | cheesehead | Forum Feedback | 3 | 2013-05-25 12:56 |
| Passing commands to PARI on Windows | James Heinrich | Software | 2 | 2012-05-13 19:19 |
| Ubiquity commands | Mini-Geek | Aliquot Sequences | 1 | 2009-09-22 19:33 |
| 64-bit Pari? | CRGreathouse | Software | 2 | 2009-03-13 04:22 |
| Are these commands correct? | jasong | Linux | 2 | 2007-10-18 23:40 |