This site is supported by donations to The OEIS Foundation.

# User:Daniel Suteu

Open-source software developer, with main interests in programming languages, algorithms, mathematics (number theory), poetry and science.

In March 2013, I started the Sidef programming language project, which combines many good things from good languages, trying to make programming easier and more enjoyable, focusing primarily on simplicity, elegance and readability.

Among other things, the language comes with fast built-in methods for primality testing and prime factorization, along with many other number-theoretic functions, most of them provided by Dana Jacobsen's excellent Math::Prime::Util::GMP module. Also built-in, we have support for arbitrary large integers, rationals, floats and complex numbers, using the GMP, MPFR and MPC libraries.

The language can be tried online at: https://tio.run/#sidef.

WWW:

## Partial sums of arithmetical functions

For any arithmetical function $f(k)$ , we have the following identity (for m >= 0):

$\sum _{k=1}^{n}\sum _{d|k}f(d)(k/d)^{m}=\sum _{k=1}^{n}f(k)\sum _{j=1}^{\left\lfloor n/k\right\rfloor }j^{m}=\sum _{k=1}^{n}f(k)F_{m}(\left\lfloor n/k\right\rfloor )$ where $F_{n}(x)$ are the Faulhaber polynomials, defined as:

$F_{n}(x)={\frac {B_{n+1}(x+1)-B_{n+1}(1)}{n+1}}$ where $B_{n}(x)$ are the Bernoulli polynomials. The Faulhaber polynomials are particularly useful in efficiently summing the m-th powers of the first n positive integers (with m >= 0):

$\sum _{k=1}^{n}k^{m}=F_{m}(n)$ ...and are also useful in efficiently computing second partial sums of m-th powers (sums of power sums) with m >= 0:

$\sum _{k=1}^{n}\sum _{j=1}^{k}j^{m}=(n+1)F_{m}(n)-F_{m+1}(n)$ In this section, we're interested in computing the following partial sum in sublinear time, with m >= 0, where $f(k)$ is an arithmetical function:

$\sum _{k=1}^{n}f(k)F_{m}(\left\lfloor n/k\right\rfloor )$ If the partial sums of $f(k)$ can be computed efficiently:

$S(n)=\sum _{k=1}^{n}f(k)$ then it's possible to create the following sublinear formula:

$\sum _{k=1}^{n}f(k)F_{m}(\left\lfloor n/k\right\rfloor )=\sum _{k=1}^{\left\lfloor {\sqrt {n}}\right\rfloor }F_{m}(k)(S(\left\lfloor n/k\right\rfloor )-S(\left\lfloor n/(k+1)\right\rfloor ))+\sum _{k=1}^{\left\lfloor n/(\left\lfloor {\sqrt {n}}\right\rfloor +1)\right\rfloor }f(k)F_{m}(\left\lfloor n/k\right\rfloor )$ More generally, the partial sums over the Dirichlet convolution of two arithmetic functions $f$ and $g$ , can be computed in sublinear time, if the individual partial sums of $f$ and $g$ can be computed efficiently:

$R(n)=\sum _{k=1}^{n}f(k)$ $S(n)=\sum _{k=1}^{n}g(k)$ Assuming that $R(n)$ and $S(n)$ can be computed efficiently, then we can use the Dirichlet hyperbola method to compute the following partial sum in sublinear time:

$\sum _{k=1}^{n}\sum _{d|k}f(d)g(k/d)=\sum _{k=1}^{\left\lfloor {\sqrt {n}}\right\rfloor }(f(k)S(\left\lfloor n/k\right\rfloor )+g(k)R(\left\lfloor n/k\right\rfloor ))-R(\left\lfloor {\sqrt {n}}\right\rfloor )S(\left\lfloor {\sqrt {n}}\right\rfloor )$ ## Partial sums of the sigma function

For m >= 0 and j >= 0, we have:

$\sum _{k=1}^{n}k^{m}\sigma _{j}(k)=\sum _{k=1}^{n}k^{m+j}F_{m}(\left\lfloor n/k\right\rfloor )=\sum _{k=1}^{n}k^{m}F_{m+j}(\left\lfloor n/k\right\rfloor )$ which can be computed in sublinear time by using the Dirichlet hyperbola method:

$\sum _{k=1}^{n}k^{m}\sigma _{j}(k)=\sum _{k=1}^{\lfloor {\sqrt {n}}\rfloor }(k^{m}F_{m+j}(\left\lfloor n/k\right\rfloor )+k^{m+j}F_{m}(\left\lfloor n/k\right\rfloor ))-F_{m+j}(\left\lfloor {\sqrt {n}}\right\rfloor )F_{m}(\left\lfloor {\sqrt {n}}\right\rfloor )$ where $F_{n}(x)$ are the Faulhaber polynomials.

An asymptotic approximation to this partial sum, with m >= 0 and j >= 1, is given by the following formula:

$\sum _{k=1}^{n}k^{m}\sigma _{j}(k)\sim {\frac {\zeta (j+1)n^{j+m+1}}{j+m+1}}$ where $\zeta (s)$ is the Riemann zeta function.

## Partial sums of the Jordan totient function

The Jordan totient function is a generalization of the Euler totient function, and is defined as:

$J_{m}(n)=n^{m}\prod _{p|n}(1-1/p^{m})$ and is multiplicative with:

$J_{m}(p^{k})=p^{km}-p^{(k-1)m}$ An elegant formula for computing partial sums of the Jordan totient function, is given in terms of the Möbius function and the Faulhaber polynomials:

$\sum _{k=1}^{n}J_{m}(k)=\sum _{k=1}^{n}\mu (k)F_{m}(\left\lfloor n/k\right\rfloor )$ An asymptotic approximation to this partial sum, with m >= 1, is given by:

$\sum _{k=1}^{n}J_{m}(k)\sim {\frac {n^{m+1}}{(m+1)\zeta (m+1)}}$ where $\zeta (s)$ is the Riemann zeta function.

## Partial sums of the Dedekind psi function

The generalized Dedekind psi function can be defined in terms of the Jordan totient function, as:

$\psi _{m}(n)={\frac {J_{2m}(n)}{J_{m}(n)}}$ and is multiplicative with:

$\psi _{m}(p^{k})=p^{km}+p^{(k-1)m}$ Partial sums of the Dedekind psi function can be expressed in terms of the absolute value of the Möbius function and the Faulhaber polynomials:

$\sum _{k=1}^{n}\psi _{m}(k)=\sum _{k=1}^{n}|\mu (k)|F_{m}(\left\lfloor n/k\right\rfloor )$ with the following asymptotic approximation for m >= 1:

$\sum _{k=1}^{n}\psi _{m}(k)\sim {\frac {n^{m+1}\zeta (m+1)}{(m+1)\zeta (2(m+1))}}$ where $\zeta (s)$ is the Riemann zeta function.

## Partial sums of the omega(n) and bigomega(n) functions

We define the generalized $\omega _{m}(n)$ and $\Omega _{m}(n)$ functions as:

$\omega _{m}(n)=\sum _{p^{k}|n}{\frac {n^{m}}{p^{m}}}$ $\Omega _{m}(n)=\sum _{p^{k}|n}\sum _{j=1}^{k}{\frac {n^{m}}{p^{jm}}}$ where $p^{k}$ are primes $p$ dividing $n$ , with multiplicity $k$ .

For $\omega _{m}(n)$ we have the following sequences:

$\omega _{0}(n)=$ A001221(n)

$\omega _{1}(n)=$ A069359(n)

$\omega _{2}(n)=$ A322078(n)

Similarly, for $\Omega _{m}(n)$ , we have:

$\Omega _{0}(n)=$ A001222(n)

$\Omega _{1}(n)=$ A095112(n)

$\Omega _{2}(n)=$ A322664(n)

Partial sums of this functions can be expressed in terms of the Faulhaber polynomials, as:

$\sum _{k=1}^{n}\omega _{m}(k)=\sum _{p}^{n}F_{m}(\left\lfloor n/p\right\rfloor )$ $\sum _{k=1}^{n}\Omega _{m}(k)=\sum _{p^{k}}^{n}F_{m}(\left\lfloor n/p^{k}\right\rfloor )$ where $p$ and $p^{k}$ (with k>=1) run over the prime numbers and the prime powers, respectively, less than or equal to $n$ .

For m>=1, the partial sums of $\omega _{m}(k)$ can be described asymptotically as:

$\sum _{k=1}^{n}\omega _{m}(k)\sim F_{m}(n)P(m+1)$ where $F_{m}(n)$ are the Faulhaber polynomials and $P(s)$ is the Prime zeta function, defined as:

$P(s)=\sum _{p}{\frac {1}{p^{s}}}$ Very similarly, for m>=1, the partial sums of $\Omega _{m}(k)$ satisfy:

$\sum _{k=1}^{n}\Omega _{m}(k)\sim F_{m}(n)Q(m+1)$ where $F_{m}(n)$ are the Faulhaber polynomials and $Q(s)$ is defined as:

$Q(s)=\sum _{k=1}^{\infty }\sum _{p}{\frac {1}{p^{sk}}}=\sum _{p}{\frac {1}{p^{s}-1}}$ where $p$ runs over the prime numbers.

## Partial sums - OEIS sequences

Considering the following partial sum, where $f(k)$ is an arithmetic function and $F_{n}(x)$ are the Faulhaber polynomials:

$R_{m}(n)=\sum _{k=1}^{n}\sum _{d|k}f(d)(k/d)^{m}=\sum _{k=1}^{n}f(k)F_{m}(\left\lfloor n/k\right\rfloor )$ gives us the following table of interesting sequences:

+------------+------------+------------+
|    f(k)    |   R_0(n)   |   R_1(n)   |
+------------+------------+------------+
| A000012(k) | A006218(n) | A024916(n) |
| A000027(k) | A024916(n) | A143127(n) |
| A010051(k) | A013939(n) | A322068(n) |
| A069513(k) | A022559(n) | A328893(n) |
| A008966(k) | A064608(n) | A173290(n) |
| A008683(k) | A000012(n) | A002088(n) |
| A000290(k) | A064602(n) | A143128(n) |
| A000010(k) | A000217(n) | A272718(n) |
| A034444(k) | A061503(n) | A306775(n) |
| A007434(k) | A000330(n) |            |
+------------+------------+------------+


## Generalized Pillai arithmetical function

For any arithmetical function $f(k)$ , we have the following identity:

$\sum _{k=1}^{n}f(gcd(n,k))=\sum _{d|n}f(d)\phi (n/d)$ where $\phi (x)$ is the Euler totient function.