Skip to content

Commit

Permalink
- Added the Number nesigma(n,k=1) and nesigma0(n) methods.
Browse files Browse the repository at this point in the history
Returns the sum and the count of the non-exponential divisors of n.

Example:

	say 30.of { .nesigma }      #=> OEIS: A160135
	say 30.of { .nesigma0 }     #=> OEIS: A160097
  • Loading branch information
trizen committed Nov 9, 2021
1 parent e8b32e3 commit 6a97cdd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
10 changes: 10 additions & 0 deletions lib/Sidef/Types/Number/Number.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17125,6 +17125,16 @@ package Sidef::Types::Number::Number {
bless \$s;
}

sub nesigma0 { # A160097: count of non-exponential divisors of n
my ($n) = @_;
$n->sigma0->sub($n->esigma0);
}

sub nesigma { # A160135: sum of non-exponential divisors of n
my ($n, $k) = @_;
$n->sigma($k)->sub($n->esigma($k));
}

sub uphi {

# Multiplicative with:
Expand Down
38 changes: 29 additions & 9 deletions lib/Sidef/Types/Number/Number.pod
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ Aliases: I<bsearch_inverse>

bsigma(n, k=1)

Returns the sum of the bi-unitary divisors of n, each divisor raised to power k.
Returns the sum of the bi-unitary divisors of n, each divisor raised to the k-th power.

say 20.of { .bsigma } #=> OEIS: A188999

Expand Down Expand Up @@ -2267,7 +2267,7 @@ The complementary error function.

esigma(n, k=1)

Returns the sum of the exponential divisors (or e-divisors) of n.
Returns the sum of the exponential divisors (or e-divisors) of n, each divisor raised to k-th power.

say 20.of { .esigma } #=> OEIS: A051377

Expand Down Expand Up @@ -3540,7 +3540,7 @@ Provided by L<Math::Prime::Util::GMP> >= 0.52.

isigma(n, k=1)

Returns the sum of the infinitary divisors of n, each divisor raised to power k.
Returns the sum of the infinitary divisors of n, each divisor raised to the k-th power.

say 20.of { .isigma } #=> OEIS: A049417

Expand Down Expand Up @@ -4831,6 +4831,26 @@ Negates the sign of <Cx> (equivalent with: C<-x>).

=cut

=head2 nesigma

nesigma(n, k=1)

Returns the sum of the non-exponential divisors of n, each divisor raised to the k-th power.

say 30.of { .nesigma } #=> OEIS: A160135

=cut

=head2 nesigma0

nesigma0(n)

Returns the count of the non-exponential divisors of n.

say 30.of { .nesigma0 } #=> OEIS: A160097

=cut

=head2 new

Number(string, base=10)
Expand Down Expand Up @@ -4931,7 +4951,7 @@ Returns the negative infinity special value (C<-Inf>).

nisigma(n, k=1)

Returns the sum of the non-infinitary divisors of n, each divisor raised to power k.
Returns the sum of the non-infinitary divisors of n, each divisor raised to the k-th power.

say 30.of { .nisigma } #=> OEIS: A348271

Expand Down Expand Up @@ -5060,7 +5080,7 @@ Although this may or may not be actually faster.

nusigma(n, k=1)

Returns the sum of the non-unitary divisors of n, each divisor raised to power k.
Returns the sum of the non-unitary divisors of n, each divisor raised to the k-th power.

say 30.of { .nusigma } #=> OEIS: A048146

Expand Down Expand Up @@ -5631,7 +5651,7 @@ Equivalent with:

n.prime_power_sigma(k=1)

Sum of the prime power divisors of n, each divisor raised to power k.
Sum of the prime power divisors of n, each divisor raised to the k-th power.

Example:

Expand Down Expand Up @@ -5707,7 +5727,7 @@ Returns an array with the prime numbers <= n, or in the range C<a..b>.

n.prime_sigma(k=1)

Sum of the unique prime divisors of n, each divisor raised to power k.
Sum of the unique prime divisors of n, each divisor raised to the k-th power.

Example:

Expand Down Expand Up @@ -5751,7 +5771,7 @@ Aliases: I<nth_prime_upper>

n.prime_usigma(k=1)

Sum of the unique unitary prime divisors of n, each divisor raised to power k.
Sum of the unique unitary prime divisors of n, each divisor raised to the k-th power.

Example:

Expand Down Expand Up @@ -6642,7 +6662,7 @@ Aliases: I<squarefree_unitary_divisors>, I<unitary_squarefree_divisors>

n.squarefree_usigma(k=1)

Sum of the unitary squarefree divisors of n, each divisor raised to power k.
Sum of the unitary squarefree divisors of n, each divisor raised to the k-th power.

Example:

Expand Down

0 comments on commit 6a97cdd

Please sign in to comment.