Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 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 l in 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]

View file

@ -0,0 +1,35 @@
def ludic():
yield 1
ludics = []
while True:
k = 0
for j in reversed(ludics):
k = (k*j)//(j-1) + 1
ludics.append(k+2)
yield k+2
def triplets():
a, b, c, d = 0, 0, 0, 0
for k in ludic():
if k-4 in (b, c, d) and k-6 in (a, b, c):
yield k-6, k-4, k
a, b, c, d = b, c, d, k
first_25 = [k for i, k in zip(range(25), gen_ludic())]
print(f'First 25 ludic numbers: {first_25}')
count = 0
for k in gen_ludic():
if k > 1000:
break
count += 1
print(f'Number of ludic numbers <= 1000: {count}')
it = iter(gen_ludic())
for i in range(1999):
next(it)
ludic2000 = [next(it) for i in range(6)]
print(f'Ludic numbers 2000..2005: {ludic2000}')
print('Ludic triplets < 250:')
for a, b, c in triplets():
if c >= 250:
break
print(f'[{a}, {b}, {c}]')