From 6a97cdd3f19f07d5fb7e90c68ecb021979d0fe78 Mon Sep 17 00:00:00 2001 From: trizen Date: Tue, 9 Nov 2021 20:04:09 +0200 Subject: [PATCH] - Added the Number `nesigma(n,k=1)` and `nesigma0(n)` methods. 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 --- lib/Sidef/Types/Number/Number.pm | 10 ++++++++ lib/Sidef/Types/Number/Number.pod | 38 +++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/lib/Sidef/Types/Number/Number.pm b/lib/Sidef/Types/Number/Number.pm index 73f81e84..a096266d 100644 --- a/lib/Sidef/Types/Number/Number.pm +++ b/lib/Sidef/Types/Number/Number.pm @@ -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: diff --git a/lib/Sidef/Types/Number/Number.pod b/lib/Sidef/Types/Number/Number.pod index 06ab14bd..6b7c0db1 100644 --- a/lib/Sidef/Types/Number/Number.pod +++ b/lib/Sidef/Types/Number/Number.pod @@ -1237,7 +1237,7 @@ Aliases: I 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 @@ -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 @@ -3540,7 +3540,7 @@ Provided by L >= 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 @@ -4831,6 +4831,26 @@ Negates the sign of (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) @@ -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 @@ -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 @@ -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: @@ -5707,7 +5727,7 @@ Returns an array with the prime numbers <= n, or in the range C. 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: @@ -5751,7 +5771,7 @@ Aliases: I 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: @@ -6642,7 +6662,7 @@ Aliases: I, I 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: