Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,22 @@
def ludic(nmax=100000):
yield 1
lst = list(range(2, nmax + 1))
while lst:
yield lst[0]
del lst[::lst[0]]
ludics = [l for i,l in zip(range(2005), ludic())]
print('First 25 ludic primes:')
print(ludics[:25])
print("\nThere are %i ludic numbers <= 1000"
% sum(1 for l in ludics if l <= 1000))
print("\n2000'th..2005'th ludic primes:")
print(ludics[2000-1: 2005])
n = 250
triplets = [(x, x+2, x+6)
for x in ludics
if x+6 < n and x+2 in ludics and x+6 in ludics]
print('\nThere are %i triplets less than %i:\n %r'
% (len(triplets), n, triplets))

View file

@ -0,0 +1,12 @@
def ludic(nmax=64):
yield 1
taken = []
while True:
lst, nmax = list(range(2, nmax + 1)), nmax * 2
for t in taken:
del lst[::t]
while lst:
t = lst[0]
taken.append(t)
yield t
del lst[::t]