Esempio n. 1
0
def is_squarefree(n):
    for p,q in math2.factorize(n):
        if q>=2:
            return False
    return True
Esempio n. 2
0
def is_squarefree(n):
    for p,q in math2.factorize(n):
        if q>=2:
            return False
    return True
Esempio n. 3
0
A000040=Sequence(math2.primes_gen,None,math2.is_prime,'The prime numbers')

A008578=Sequence(
    math2.primes_gen(1),
    None,
    lambda n: math2.is_prime(n,oneisprime=True),
    'Prime numbers at the beginning of the 20th century (today 1 is no longer regarded as a prime).'
)

A065091=Sequence(math2.primes_gen(3),None,lambda x:x!=2 and math2.is_prime(x),'The odd prime numbers')

A001248=A000040.apply(lambda n:n*n,lambda n:math2.is_prime(math2.isqrt(n)),desc='Square of primes')

A030078=A000040.apply(lambda n:n*n*n,desc='Cubes of primes')

A000961=Sequence(1,None,lambda n:len(list(math2.factorize(n)))==1,
    desc='Powers of primes. Alternatively, 1 and the prime powers (p^k, p prime, k >= 1).'
)

A000043=A000040.filter(math2.lucas_lehmer,'Mersenne exponents: primes p such that 2^p - 1 is prime.')

A001348=A000040.apply(lambda p:A000079[p]-1,desc='Mersenne numbers: 2^p - 1, where p is prime.')

A000668=A000043.apply(lambda p:A000079[p]-1,desc='Mersenne primes (of form 2^p - 1 where p is a prime).')

A000396=A000043.apply(lambda p:A000079[p-1]*(A000079[p] - 1),
    containf=lambda x:math2.is_perfect(x)==0,
    desc='Perfect numbers n: n is equal to the sum of the proper divisors of n.'
)

def exp_sequences(a,b,c,desc_s1=None,desc_s2=None,desc_s3=None,start=0):
Esempio n. 4
0
A000040=Sequence(math2.primes_gen,None,math2.is_prime,'The prime numbers')

A008578=Sequence(
    math2.primes_gen(1),
    None,
    lambda n: math2.is_prime(n,oneisprime=True),
    'Prime numbers at the beginning of the 20th century (today 1 is no longer regarded as a prime).'
)

A065091=Sequence(math2.primes_gen(3),None,lambda x:x!=2 and math2.is_prime(x),'The odd prime numbers')

A001248=A000040.apply(lambda n:n*n,lambda n:math2.is_prime(math2.isqrt(n)),desc='Square of primes')

A030078=A000040.apply(lambda n:n*n*n,desc='Cubes of primes')

A000961=Sequence(1,None,lambda n:len(list(math2.factorize(n)))==1,
    desc='Powers of primes. Alternatively, 1 and the prime powers (p^k, p prime, k >= 1).'
)

A000043=A000040.filter(math2.lucas_lehmer,'Mersenne exponents: primes p such that 2^p - 1 is prime.')

A001348=A000040.apply(lambda p:A000079[p]-1,desc='Mersenne numbers: 2^p - 1, where p is prime.')

A000668=A000043.apply(lambda p:A000079[p]-1,desc='Mersenne primes (of form 2^p - 1 where p is a prime).')

A000396=A000043.apply(lambda p:A000079[p-1]*(A000079[p] - 1),
    containf=lambda x:math2.is_perfect(x)==0,
    desc='Perfect numbers n: n is equal to the sum of the proper divisors of n.'
)

def exp_sequences(a,b,c,desc_s1=None,desc_s2=None,desc_s3=None,start=0):