Skip to content

Commit 82f0107

Browse files
authored
Update math.py
Add help() function
1 parent 5cc7e64 commit 82f0107

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

cyaron/math.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,35 @@
1010

1111

1212
fact = (1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880)
13+
def help(): #Give help informations
14+
help_txt="""
15+
Welcome to CYaRon/math.py help!
16+
Functions are:
17+
| factorial(n) - The factorial of n
18+
| is_perm(a,b) - Check if number a and b share the same digits
19+
| is_palindromic(n) - Check if n is palindromic(i.e. The number does not change if you reverse it)
20+
| is_pandigital(n,s=9) - Check if number n is made from sequence 1 to s
21+
| d(n) - Calculate the sum of proper divisors for n
22+
| pal_list(k) - Create a list of all palindromic numbers with k digits
23+
| sof_digits(n) - Sum of factorial's digits
24+
| fibonacci(n) - Find the nth Fibonacci number
25+
| sos_digits(n) - Sum of squares of digits
26+
| pow_digits(n,e) - Sum of the digits to a power e
27+
| is_prime(n) - Check n for prime
28+
| miller_rabin(n) - Miller-Rabin primality test
29+
| factor(n) - Factor a number into primes and frequency
30+
| perm(n,s) - Find the nth pemutation of string s
31+
| binomial(n,k) - Calculate C(n,k)
32+
| catalan_number(n) - Calculate the nth Catalan number
33+
| prime_sieve(n) - Return a list of prime numbers from 2 to a prime < n
34+
| exgcd(a,b) - Bézout coefficients. Returns (u, v, gcd(a,b))
35+
| mod_inverse(a,b) - returns u of exgcd(a,b)
36+
| phi(x) - The PHI function of x
37+
| miu(x) - The MIU function of x
38+
| dec2base(n,base) - Number base conversion
39+
| n2words(num,join=True) - Number to words
40+
"""
41+
print(help_txt)
1342

1443
def factorial(n): return reduce(lambda x,y:x*y,range(1,n+1),1)
1544

0 commit comments

Comments
 (0)