absfuyu.dxt.intext module

Absfuyu: Data Extension

int extension

Version: 5.1.0 Date updated: 10/03/2025 (dd/mm/yyyy)

class absfuyu.dxt.intext.IntExt[source]

Bases: ShowAllMethodsMixin, int

int extension

to_binary() str[source]

Convert to binary number

Returns:

Binary number

Return type:

str

Example:

>>> test = IntNumber(10)
>>> test.to_binary()
'1010'
to_celcius_degree() float[source]

Convert into Celcius degree as if self is Fahrenheit degree

Returns:

Celcius degree

Return type:

float

Example:

>>> test = IntNumber(10)
>>> test.to_celcius_degree()
-12.222222222222221
to_fahrenheit_degree() float[source]

Convert into Fahrenheit degree as if self is Celcius degree

Returns:

Fahrenheit degree

Return type:

float

Example:

>>> test = IntNumber(10)
>>> test.to_fahrenheit_degree()
50.0
reverse() Self[source]

Reverse a number. Reverse abs(number) if number < 0

Returns:

Reversed number

Return type:

IntNumber

Example:

>>> test = IntNumber(102)
>>> test.reverse()
201
is_even() bool[source]

An even number is a number which divisible by 2

Returns:

True if an even number
False if not an even number

Return type:

bool

is_prime() bool[source]

Check if the integer is a prime number or not

A prime number is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number.

Returns:

True if a prime number
False if not a prime number

Return type:

bool

is_twisted_prime() bool[source]

A number is said to be twisted prime if it is a prime number and reverse of the number is also a prime number

Returns:

True if a twisted prime number
False if not a twisted prime number

Return type:

bool

is_perfect() bool[source]

Check if integer is perfect number

Perfect number: a positive integer that is equal to the sum of its proper divisors. The smallest perfect number is 6, which is the sum of 1, 2, and 3. Other perfect numbers are 28, 496, and 8,128.

Returns:

True if a perfect number
False if not a perfect number

Return type:

bool

is_narcissistic() bool[source]

Check if a narcissistic number

In number theory, a narcissistic number (also known as a pluperfect digital invariant (PPDI), an Armstrong number (after Michael F. Armstrong) or a plus perfect number) in a given number base b is a number that is the sum of its own digits each raised to the power of the number of digits.

Returns:

True if a narcissistic number
False if not a narcissistic number

Return type:

bool

is_palindromic() bool[source]

A palindromic number (also known as a numeral palindrome or a numeric palindrome) is a number (such as 16461) that remains the same when its digits are reversed.

Returns:

True if a palindromic number
False if not a palindromic number

Return type:

bool

is_palindromic_prime() bool[source]

A palindormic prime is a number which is both palindromic and prime

Returns:

True if a palindormic prime number
False if not a palindormic prime number

Return type:

bool

lcm(with_number: int) Self[source]

Least common multiple of self and with_number

Parameters:

with_number (int) – The number that want to find LCM with

Returns:

Least common multiple

Return type:

IntNumber

Example:

>>> test = IntNumber(102)
>>> test.lcm(5)
510
gcd(with_number: int) Self[source]

Greatest common divisor of self and with_number

Parameters:

with_number (int) – The number that want to find GCD with

Returns:

Greatest common divisor

Return type:

IntNumber

Example:

>>> test = IntNumber(1024)
>>> test.gcd(8)
8

Changed in version 3.3.0: Updated functionality

add_to_one_digit(master_number: bool = False) Self[source]

Convert self into 1-digit number by adding all of the digits together

Parameters:

master_number (bool) –

Break when sum = 22 or 11 (numerology)
(Default: False)

Returns:

IntNumber

Return type:

IntNumber

Example:

>>> test = IntNumber(119)
>>> test.add_to_one_digit()
2
>>> test = IntNumber(119)
>>> test.add_to_one_digit(master_number=True)
11
divisible_list() list[int][source]

A list of divisible number

Returns:

A list of divisible number

Return type:

list[int]

Example:

>>> test = IntNumber(1024)
>>> test.divisible_list()
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]

Changed in version 5.0.0: Removed ``short_form`` parameter

prime_factor(short_form: bool = True) list[int] | list[Pow][source]

Prime factor

Parameters:

short_form (bool) –

Show prime list in short form
Normal example: [2, 2, 2, 3, 3]
Short form example: [2^3, 3^2]
(Default: True)

Returns:

List of prime number that when multiplied together == self
list[int]: Long form
list[Pow]: Short form

Return type:

list[int] | list[Pow]

Example:

>>> test = IntNumber(1024)
>>> test.prime_factor()
[2^10]
>>> test = IntNumber(1024)
>>> test.prime_factor(short_form=False)
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
analyze(short_form: bool = True) dict[str, dict[str, Any]][source]

Analyze the number with almost all IntNumber method

Parameters:

short_form (bool) –

Enable short form for some items
(Default: True)

Returns:

Detailed analysis

Return type:

dict[str, dict[str, Any]]

Example:

>>> test = IntNumber(1024)
>>> test.analyze()
{
    'summary': {'number': 1024, 'length': 4, 'even': True, 'prime factor': [2^10], 'divisible': [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]},
    'convert': {'binary': '10000000000', 'octa': '2000', 'hex': '400', 'reverse': 4201, 'add to one': 7},
    'characteristic': {'prime': False, 'twisted prime': False, 'perfect': False, 'narcissistic': False, 'palindromic': False, 'palindromic prime': False}
}
split(parts: int) list[int][source]

Evenly split the number into parts parts

Parameters:

parts (int) – Split by how many parts

Returns:

List of evenly splitted numbers

Return type:

list[int]

Example:

>>> IntExt(10).split(4)
[2, 2, 3, 3]

Added in version 5.1.0

class absfuyu.dxt.intext.Pow(number: int | float, power_by: int)[source]

Bases: object

Number power by a number

to_list() list[int][source]

Convert into list

Return type:

list[int | float]

calculate() float[source]

Calculate the self.number to the power of self.power_by

Return type:

float