Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 15 Sep 2005 @ 15:40:46 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Factorial in Teradata
 
From:   Morris, Mark

What is the top end of the range on which you need to support the factorial?

Factorial grows really fast, so I am wondering what data type you are going to use for the result.

Maybe a small look up table would be the way to go.

     2! = 2 (0x2)
     3! = 6 (0x6)
     4! = 24 (0x18)
     5! = 120 (0x78)
     6! = 720 (0x2d0)
     7! = 5040 (0x13b0)
     8! = 40320 (0x9d80)
     9! = 362880 (0x58980)
     10! = 3628800 (0x375f00)
     11! = 39916800 (0x2611500)
     12! = 479001600 (0x1c8cfc00)
     13! = 6227020800 (0x17328cc00)
     14! = 87178291200 (0x144c3b2800)
     15! = 1307674368000 (0x13077775800)
     16! = 20922789888000 (0x130777758000)
     17! = 355687428096000 (0x1437eeecd8000)
     18! = 6402373705728000 (0x16beecca730000)
     19! = 121645100408832000 (0x1b02b9306890000)
     20! = 2432902008176640000 (0x21c3677c82b40000)
     21! = 51090942171709440000 (0x2c5077d36b8c40000)
     22! = 1124000727777607680000 (0x3ceea4c2b3e0d80000)
     23! = 25852016738884976640000 (0x57970cd7e2933680000)
     24! = 620448401733239439360000 (0x83629343d3dcd1c00000)
     25! = 15511210043330985984000000 (0xcd4a0619fb0907bc00000)
     26! = 403291461126605635584000000 (0x14d9849ea37eeac91800000)
     27! = 10888869450418352160768000000 (0x232f0fcbb3e62c3358800000)
     28! = 304888344611713860501504000000 (0x3d925ba47ad2cd59dae000000)
     29! = 8841761993739701954543616000000 (0x6f99461a1e9e1432dcb6000000)
     30! = 265252859812191058636308480000000 (0xd13f6370f96865df5dd54000000)
     31! = 8222838654177922817725562880000000
     (0x1956ad0aae33a4560c5cd2c000000)
     32! = 263130836933693530167218012160000000
     (0x32ad5a155c6748ac18b9a580000000)
     33! = 8683317618811886495518194401280000000
     (0x688589cc0e9505e2f2fee5580000000)
     34! = 295232799039604140847618609643520000000
     (0xde1bc4d19efcac82445da75b00000000)
     35! = 10333147966386144929666651337523200000000
     (0x1e5dcbe8a8bc8b95cf58cde17100000000)
     36! = 371993326789901217467999448150835200000000
     (0x44530acb7ba83a111287cf3b3e400000000)
     37! = 13763753091226345046315979581580902400000000
     (0x9e0008f68df506477ada0f38fff400000000)
     38! = 523022617466601111760007224100074291200000000
     (0x1774015499125eee9c3c5e4275fe3800000000)
     39! = 20397882081197443358640281739902897356800000000
     (0x392ac33e351cc7659cd325c1ff9ba8800000000)
     40! = 815915283247897734345611269596115894272000000000
     (0x8eeae81b84c7f27e080fde64ff05254000000000)
     41! = 33452526613163807108170062053440751665152000000000
     (0x16e39f2c684405d62f4a8a9e2cd7d2f74000000000)
     42! = 1405006117752879898543142606244511569936384000000000
     (0x3c1581d491b28f523c23abdf35b689c908000000000)


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023