Re: need to make a special function

*To*: mathgroup at smc.vnet.net*Subject*: [mg68317] Re: need to make a special function*From*: "sashap" <pavlyk at gmail.com>*Date*: Tue, 1 Aug 2006 06:59:44 -0400 (EDT)*References*: <eakec7$qvd$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi Nabeel, You could try the following In[1]:= f[k_Integer]:=IntegerDigits[#,2,k]& /@ Range[0,2^k-1] In[2]:= f[10];//Timing Out[2]= {0. Second,Null} In[3]:= f[20];//Timing Out[3]= {1.047 Second,Null} In[4]:= f[3] Out[4]= {{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}} Oleksandr Pavlyk Wolfram Research Nabeel Butt wrote: > Dear Users, > I need help on making a special type of function which has the > following properties. > f[1]={{0},{1}} > f[2]={{0,0},{0,1},{1,0},{1,1}} > f[3]={{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}} > .............so on you can see the pattern emerging. > I need a very efficient code to perform the above evaluation in some > optimization problem. > Thanks in advance. > regards, > Nabeel > -- > Nabeel Butt > LUMS,Lahore