William Stein wrote: > Hello, > > Jaap, thanks for the example. I suggest as a possible community project > that we create a file in SAGE that has functions for computing (entirely > using SAGE) as numerous of the integer sequences defined in Sloane's > tables. This would be a nice addition to sage/databases/sloane.py. > > If you sent me say 5 or six function, I could put them together in order > to get this going. Let me know what you think? > > This would be a massive project for any one person, but if several people > all > worked on it, then it might not be so bad. >
William: What do you think of a wiki page for such functions? I could set one up if you think it's a good idea. > William > > > On Thu, 07 Dec 2006 12:28:30 -0800, Jaap Spies <[EMAIL PROTECTED]> wrote: > > >> From Sloan's A001694: >> http://www.research.att.com/~njas/sequences/A001694 >> >> Powerful Numbers: >> A positive integer n is powerful if for every prime p dividing n, p^2 >> also >> divides n. >> There is a Mathematica program. >> >> sage: mathematica_console() >> Mathematica 5.2 for Linux x86 (64 bit) >> Copyright 1988-2005 Wolfram Research, Inc. >> -- Terminal graphics initialized -- >> >> In[1]:= Select[ Range[ 2, 2500 ], >> Position[ Union[ Transpose[ FactorInteger[ >> # ] ][ [ 2 ] ] ], 1 ] == {} & ] >> >> Out[1]= {4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 72, 81, 100, 108, 121, 125, >> >> > 128, 144, 169, 196, 200, 216, 225, 243, 256, 288, 289, 324, 343, >> 361, >> >> > 392, 400, 432, 441, 484, 500, 512, 529, 576, 625, 648, 675, 676, >> 729, >> >> > 784, 800, 841, 864, 900, 961, 968, 972, 1000, 1024, 1089, 1125, >> 1152, >> >> > 1156, 1225, 1296, 1323, 1331, 1352, 1369, 1372, 1444, 1521, 1568, >> 1600, >> >> > 1681, 1728, 1764, 1800, 1849, 1936, 1944, 2000, 2025, 2048, 2116, >> 2187, >> >> > 2197, 2209, 2304, 2312, 2401, 2500} >> >> >> I really hope and expect that SAGE-programming will never look like the >> above! >> >> The more SAGE-an way: >> >> def is_powerful(n): >> r""" >> A Powerful Number: >> A positive integer $n$ is powerful if for every prime >> $p$ dividing >> $n$, $p^2$ also divides $n$. >> >> EXAMPLE >> """ >> for p in prime_divisors(n): >> if n % p^2 > 0: >> return False >> return True >> >> def alist(n): >> return [i for i in range(1,n+1) if is_powerful(i)] >> >> print alist(2500) >> [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 72, 81, 100, 108, 121, 125, >> 128, 144, >> 169, 196, 200, 216, 225, 243, 256, 288, 289, 324, 343, 361, 392, 400, >> 432, >> 441, 484, 500, 512, 529, 576, 625, 648, 675, 676, 729, 784, 800, 841, >> 864, >> 900, 961, 968, 972, 1000, 1024, 1089, 1125, 1152, 1156, 1225, 1296, 1323, >> 1331, 1352, 1369, 1372, 1444, 1521, 1568, 1600, 1681, 1728, 1764, 1800, >> 1849, >> 1936, 1944, 2000, 2025, 2048, 2116, 2187, 2197, 2209, 2304, 2312, 2401, >> 2500] >> >> >> >> In the OEIS there are a lot of Mathematics programs like this. We can do >> better and will do better! >> >> Jaap >> >> >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---
