# Comparing weighted densities

## Abstract

In this paper we study inequalities between weighted densities of sets of natural numbers corresponding to different weight functions. Depending on the asymptotic relation between the weight functions, we give sharp bounds for possible values of one density when the values of another density are given. In particular, we give a condition for two weight functions to generate equivalent weighted densities.

## 1 Introduction

Denote by $$\mathbb{N}$$ the set of positive integers. Let $$\chi _{A}$$ denote the characteristic function for a given subset $$A \subset \mathbb{N}$$. Weighted densities were studied in [1] and [2], where a generalization of both asymptotic and logarithmic densities was provided.

We call a positive function $$f\colon \mathbb{N}\to \mathbb{R}^{+}$$ an Erdős–Ulam function if it satisfies $$f(1)= 1$$,

$$\sum_{n=1}^{\infty }f(n)=\infty ,$$
(1)

and

$$\lim_{n\to \infty} f^{*}(n)=0, \quad \text{where } f^{*}(n)= \frac{f(n)}{\sum_{j=1}^{n} f(j)} .$$
(2)

With respect to an Erdős–Ulam function $$f(n)$$ the weighted densities are defined as follows. For $$A\subset \mathbb{N}$$ denote

$$F_{A}(n)= \frac{\sum_{j=1}^{n} f(j)\cdot \chi _{A}(j)}{S_{f}(n)} , \quad \text{where } S_{f}(n)=\sum_{j=1}^{n} f(j) .$$

Clearly, $$0\le F_{A}(n)\le 1$$. Now, we define the lower and upper f-densities of A by

$$\underline{d}_{f}(A)=\liminf_{n\to \infty}F_{A}(n) \quad \text{and} \quad \overline{d}_{f}(A)=\limsup_{n\to \infty}F_{A}(n),$$

respectively. In the case when $$\underline{d}_{f}(A) = \overline{d}_{f}(A)$$ we say that A possesses the f-density $$d_{f}(A)$$.

The symbols $$G_{A}(n)$$, $$S_{g}(n)$$, $$\underline{d}_{g}(A)$$, $$\overline{d}_{g}(A)$$, and $$d_{g}(A)$$ will have analogous meanings, with respect to Erdős–Ulam function $$g(n)$$.

Note that the asymptotic density corresponds to $$f(n) = 1$$, while the logarithmic density corresponds to $$f(n) = \frac{1}{n}$$. Also, note that for every weighted density $$d_{f}$$ and every set $$A\subset \mathbb{N}$$ we have the complementary property

$$\overline{d}_{f}(A)=1-\underline{d}_{f}( \mathbb{N}\setminus A) .$$
(3)

The weighted density $$d'$$ is called stronger than the weighted density d (d is weaker than $$d'$$) if, for any set $$A\subset \mathbb{N}$$,

$$\underline{d}'(A)\le \underline{d}(A) \le \overline{d}(A) \le \overline{d}{}'(A).$$

Two weighted densities are called comparable if one of them is stronger than the other (see [3]). It is known that the logarithmic density is weaker than the asymptotic one. More generally, all of the $$n^{\alpha }$$-densities, where $$\alpha \ge -1$$, are comparable, namely if $$-1\le \alpha <\beta$$ then $$n^{\alpha }$$-density is weaker than $$n^{\beta }$$-density.

We say that the weighted density d extends the weighted density $$d'$$ if every set $$A\subset \mathbb{N}$$ that possesses density $$d'$$, also possesses density d and $$d(A)=d'(A)$$. Clearly, if $$d'$$ is stronger than d, then d extends $$d'$$. If one weighted density extends the other one and vice-versa, then the two densities are said to be equivalent.

The weighted densities d and $$d'$$ are strongly equivalent if for every set $$A\subset \mathbb{N}$$ there holds $$\underline{d}(A)=\underline{d}'(A)$$. Of course, then $$\overline{d}(A)=\overline{d}{}'(A)$$.

Kuipers and Niederreiter [4] observed that all the $$n^{\alpha }$$-densities with $$\alpha > -1$$ are equivalent to each other. The main tool to compare weighted densities (e.g., see [3, 58]) is the classical result of Rajagopal (cf. [9], Theorem 3) which, in terms of weighted densities, states the following.

### Theorem 1

Let $$f,g\colon \mathbb{N}\to (0,\infty )$$ be Erdős–Ulam functions. If function $$\frac{f(n)}{g(n)}$$ is decreasing then $$d_{g}$$ is stronger than $$d_{f}$$.

The following sufficient condition is found in Hardy [10] (see also [4]).

### Theorem 2

If function $$\frac{f(n)}{g(n)}$$ is increasing and function $$\frac{f(n)S_{g}(n)}{g(n)S_{f}(n)}$$ is bounded then the f-density extends the g-density.

A survey on weighted densities and their connection with the first digit problem is given in [11]. It is proved that if $$f(n)\sim g(n)$$ as $$n\to \infty$$, then the corresponding f-density and g-density are strongly equivalent.

Consider the following sequence of functions

\begin{aligned} &f_{0}(n)=1 , \\ &f_{k}(n)=f_{k-1}^{*}(n)\sim \frac{1}{\prod_{j=0}^{k-1}\ln ^{[j]}n}\quad \text{for }k\ge 1 , \end{aligned}

where $$\ln ^{[0]}n=n$$ and $$\ln ^{[j+1]}n=\ln \ln ^{[j]}n$$. Then, from [12] it follows that for every $$k\ge 1$$, function $$f_{k}$$ is an Erdős–Ulam function and the corresponding $$f_{k+1}$$-density strictly extends the $$f_{k}$$-density. As a consequence of a more general theorem in [12], we have the fact that for arbitrary real numbers

$$0\le \alpha _{0}\le \alpha _{1}\le \alpha _{2} \le \cdots \le \beta _{2} \le \beta _{1}\le \beta _{0}\le 1$$

there exists an $$A\subset \mathbb{N}$$ such that

$$\underline{d}_{f_{0}}(A)=\alpha _{0}, \qquad \underline{d}_{f_{1}}(A)= \alpha _{1}, \qquad \dots ,\qquad \overline{d}_{f_{1}}(A)=\beta _{1}, \qquad \overline{d}_{f_{0}}(A)= \beta _{0} .$$

## 2 New results

In this paper we study the relations between the weighted densities defined by Erdős–Ulam functions $$f(n)$$ and $$g(n)$$. We show that the relation between f-density and g-density mainly depends on the asymptotic behavior of the function

$$\frac{f^{*}(n)}{g^{*}(n)}= \frac{\frac{f(n)}{S_{f}(n)}}{\frac{g(n)}{S_{g}(n)}} = \frac{\frac{f(n)}{\sum_{j=1}^{n} f(j)}}{\frac{g(n)}{\sum_{j=1}^{n} g(j)}} .$$

We prove the following results, depending on the asymptotic behavior of the function $$\frac{f^{*}(n)}{g^{*}(n)}$$.

• If $$\frac{f^{*}(n)}{g^{*}(n)}\to 1$$, then the $$d_{f}$$-density and $$d_{g}$$-density are strongly equivalent.

• If $$\frac{f^{*}(n)}{g^{*}(n)}\to p>1$$, then the f-density is stronger than the g-density and for every $$A\subset \mathbb{N}$$ we give the best possible bounds for $$\underline{d}_{f}(A)$$ and $$\overline{d}_{f}(A)$$ in terms of $$\underline{d}_{g}(A)$$, $$\overline{d}_{g}(A)$$.

• If $$\frac{f^{*}(n)}{g^{*}(n)}\to \infty$$ and moreover $$f(n)$$ and $$g(n)$$ are monotone then for arbitrary real numbers $$0\le \alpha \le \beta \le \gamma \le \delta \le 1$$ there exists an $$A\subset \mathbb{N}$$ such that

$$\underline{d}_{f}(A)=\alpha , \qquad \underline{d}_{g}(A)= \beta , \qquad \overline{d}_{g}(A)=\gamma , \qquad \overline{d}_{f}(A)=\delta .$$

## 3 Properties of Erdős–Ulam functions

In this section we present several general properties of Erdős–Ulam functions that we will use later in the proofs.

From (2) it follows that each Erdős–Ulam function f satisfies

$$\frac{S_{f}(n)}{S_{f}(n+1)}=1-f^{*}(n+1)\to 1 \quad \text{as } n \to \infty .$$
(4)

Similarly, we obtain

$$\frac{f(n+1)}{S_{f}(n)}= \frac{f(n+1)}{S_{f}(n+1) (1-\frac{f(n+1)}{S_{f}(n+1)} )}\sim \frac{f(n+1)}{S_{f}(n+1)}=f^{*}(n+1) \to 0 .$$
(5)

Using the backward difference operator

$$(\nabla \varphi ) (n)=\varphi (n)-\varphi (n-1) ,$$

together with (2) and (5) we obtain

$$\nabla \ln S_{f}(n)=\ln \frac{S_{f}(n)}{S_{f}(n-1)} =\ln \biggl(1+ \frac{f(n)}{S_{f}(n-1)} \biggr) \sim f^{*}(n) .$$
(6)

### Lemma 1

Let f be an Erdős–Ulam function and $$A\subset \mathbb{N}$$. Then, for every $$n>1$$

$$\bigl\lvert F_{A}(n)-F_{A}(n-1)\bigr\rvert \leq f^{*}(n) .$$

### Proof

This inequality immediately follows from the following identity

\begin{aligned} F_{A}(n)-F_{A}(n-1)&= \frac{\sum_{k=1}^{n-1}f(k)\chi _{A}(k)+f(n)\chi _{A}(n)}{\sum_{k=1}^{n-1}f(k)+f(n)}- \frac{\sum_{k=1}^{n-1}f(k)\chi _{A}(k)}{\sum_{k=1}^{n-1}f(k)} \\ &= \frac{f(n) (\chi _{A}(n)\sum_{k=1}^{n-1}f(k)- \sum_{k=1}^{n-1}f(k)\chi _{A}(k) )}{\sum_{k=1}^{n}f(k)\sum_{k=1}^{n-1}f(k)} \\ &=f^{*}(n) \bigl(\chi _{A}(n)-F_{A}(n-1) \bigr) \end{aligned}

and from the fact that $$\lvert \chi _{A}(n)-F_{A}(n-1)\rvert \le 1$$. □

## 4 The case $$\frac{f^{*}(n)}{g^{*}(n)}\to p>1$$

In [13] it was proved that for Erdős–Ulam functions $$f(n)$$, $$g(n)$$ satisfying

$$\lim_{n\to \infty} \frac{f^{*}(n)}{g^{*}(n)} = p>1$$
(7)

the f-density is stronger than the g-density. Inequalities between upper and lower weighted densities of the type $$n^{p}$$ ($$p>-1$$) were proved in [5]. For example, let $$A\subset \mathbb{N}$$ be such that

$$\underline{d}_{1}(A)=\beta < \gamma =\overline{d}_{1}(A) .$$

Then, for $$p>1$$ for the lower $$n^{p-1}$$-density of the set A we have

$$\frac{\beta ^{p}}{\gamma ^{p-1}}\le \underline{d}_{p-1}(A)\le \beta .$$

The purpose of this section is to generalize this type of result. Note, in the case $$f(n)=n^{p-1}$$, $$g(n)=1$$, $$p>1$$ there holds $$\frac{f^{*}(n)}{g^{*}(n)}\to p$$.

The following lemmas will be used in the proof of Theorem 3.

### Lemma 2

Assume that f and g are Erdős–Ulam functions satisfying (7). Then, for every set $$A\subset \mathbb{N}$$ we have the following inequalities.

$$\underline{d}_{f}(A)\le \underline{d}_{g}(A) \le \overline{d}_{g}(A)\le \overline{d}_{f}(A) .$$
(8)

### Proof

See Theorem 3.2 of [13]. □

### Lemma 3

Assume that f and g are Erdős–Ulam functions satisfying (7). Then, for arbitrary $$\varepsilon \in (0,p)$$ there is $$N_{1}(\varepsilon )$$ such that for every $$m>n\ge N_{1}(\varepsilon )$$ we have

$$\biggl( \frac{S_{g}(m)}{S_{g}(n)} \biggr)^{p-\varepsilon} < \frac{S_{f}(m)}{S_{f}(n)}< \biggl( \frac{S_{g}(m)}{S_{g}(n)} \biggr)^{p+ \varepsilon} .$$

### Proof

Let $$\varepsilon \in (0,p)$$. Then, from (6) and (7) it follows that

$$\lim_{n\to \infty}\frac{\nabla \ln S_{f}(n)}{\nabla \ln S_{g}(n)}=p$$

and hence there is $$N_{1}(\varepsilon )$$ such that for every $$k\ge N_{1}(\varepsilon )$$

$$\frac{\nabla \ln S_{f}(k)}{\nabla \ln S_{g}(k)}\in (p-\varepsilon ,p+ \varepsilon ) .$$

Then, for every $$m>n\ge N_{1}(\varepsilon )$$

$$\frac{\ln \frac{S_{f}(m)}{S_{f}(n)}}{\ln \frac{S_{g}(m)}{S_{g}(n)}} = \frac{\ln S_{f}(m)-\ln S_{f}(n)}{\ln S_{g}(m)-\ln S_{g}(n)} = \frac{\sum_{k=n+1}^{m}\nabla \ln S_{f}(k)}{\sum_{k=n+1}^{m}\nabla \ln S_{g}(k)} \in (p-\varepsilon ,p+\varepsilon )$$

by the mediant inequality. The result follows by exponentiation of this equation. □

### Lemma 4

Assume that f and g are Erdős–Ulam functions satisfying (7). Let $$A\subset \mathbb{N}$$ be a set such that $$\underline{d}_{g}(A)=\beta >0$$ and $$\overline{d}_{g}(A)=\gamma >0$$. Let $$\varepsilon >0$$ be given by

$$1+\varepsilon +\varepsilon ^{2}< p .$$
(9)

Denote

$$t_{\varepsilon}=(1+\varepsilon )^{2p}\gamma ^{p-1+\varepsilon} .$$

Then, there is $$N_{2}$$ such that for every $$n\ge N_{2}$$ we have

$$G_{A}(n)^{p+\varepsilon}< t_{\varepsilon }F_{A}(n) .$$
(10)

### Proof

Let $$\varepsilon >0$$ satisfying (9) be given. Then, there is $$N_{3}$$ such that for every $$n\ge N_{3}$$

$$G_{A}(n)< \gamma (1+\varepsilon ) .$$
(11)

From (2), (7), and the fact that

$$\frac{\frac{f(n+1)}{S_{f}(n)}}{\frac{g(n+1)}{S_{g}(n)}}= \frac{f^{*}(n+1)}{g^{*}(n+1)}\cdot \frac{1-g^{*}(n+1)}{1-f^{*}(n+1)}$$

we obtain that there in $$N_{4}\ge N_{3}$$ such that for every $$n\ge N_{4}$$ we have

$$\frac{f(n+1)}{S_{f}(n)}>\bigl(p-\varepsilon ^{2}\bigr) \frac{g(n+1)}{S_{g}(n)} .$$
(12)

From $$\liminf_{n\to \infty} G_{A}(n)=\underline{d}_{g}(A)>0$$ and from (5) for function g we obtain that

$$\frac{g(n+1)}{G_{A}(n)S_{g}(n)}\to 0$$

and hence there is $$N_{5}\ge N_{4}$$ such that for every $$n\ge N_{5}$$

$$\frac{g(n+1)}{G_{A}(n)S_{g}(n)}< (1+\varepsilon )^{ \frac{1}{p-1+\varepsilon}}-1 .$$
(13)

Now, Lemma 2 implies that

$$0< \overline{d}_{g}(A)=\limsup_{n\to \infty} G_{A}(n)\le \limsup_{n \to \infty} F_{A}(n)= \overline{d}_{f}(A)$$

and hence there are infinitely many integers $$n_{k}\ge N_{5}$$ such that

$$G_{A}(n_{k})< (1+\varepsilon )^{2} F_{A}(n_{k}) .$$

For such numbers we have

\begin{aligned} G_{A}(n_{k})^{p+\varepsilon} &= G_{A}(n_{k})^{p-1+\varepsilon} G_{A}(n_{k}) < \bigl(\gamma (1+\varepsilon ) \bigr)^{p-1+\varepsilon}(1+\varepsilon )^{2} F_{A}(n_{k}) \\ &= \gamma ^{p-1+\varepsilon} (1+\varepsilon )^{p+1+\varepsilon} F_{A}(n_{k}) \\ &< \gamma ^{p-1+\varepsilon}(1+\varepsilon )^{2p}F_{A}(n_{k}) = t_{ \varepsilon }F_{A}(n_{k}) , \end{aligned}

i.e., (10) holds for every $$n_{k}$$.

Take $$k_{0}$$ such that $$n_{k_{0}}\ge \max \{N_{5},N_{1}(\varepsilon )\}$$ where $$N_{1}(\varepsilon )$$ is given by Lemma 3, and denote $$N_{2}=n_{k_{0}}$$. We will finish the proof by proving that (10) holds for every $$n\ge N_{2}$$.

Hence, we assume that (10) holds for some $$n\ge N_{2}$$ and we prove that it holds for $$n+1$$.

From the second inequality in Lemma 3 we obtain

$$\biggl(\frac{S_{g}(n)}{S_{g}(n+1)} \biggr)^{p+\varepsilon}< \frac{S_{f}(n)}{S_{f}(n+1)} .$$
(14)

Now, consider two cases.

1. First assume that $$n+1\notin A$$. Then,

$$G_{A}(n+1)=\frac{G_{A}(n)S_{g}(n)}{S_{g}(n+1)} \quad \text{and}\quad F_{A}(n+1)= \frac{F_{A}(n)S_{f}(n)}{S_{f}(n+1)} .$$

Using this and (14) multiplied by (10) we obtain

$$G_{A}(n+1)^{p+\varepsilon}= \biggl(\frac{G_{A}(n)S_{g}(n)}{S_{g}(n+1)} \biggr)^{p+\varepsilon}< t_{\varepsilon } \frac{F_{A}(n)S_{f}(n)}{S_{f}(n+1)}=t_{\varepsilon }F_{A}(n+1) ,$$

i.e., (10) holds for $$n+1$$.

2. Now, assume that $$n+1\in A$$. Then,

$$F_{A}(n+1)=\frac{F_{A}(n)S_{f}(n)+f(n+1)}{S_{f}(n+1)}= \frac{S_{f}(n)}{S_{f}(n+1)} \biggl(F_{A}(n)+\frac{f(n+1)}{S_{f}(n)} \biggr)$$
(15)

and similarly

$$G_{A}(n+1)^{p+\varepsilon}= \biggl(\frac{S_{g}(n)}{S_{g}(n+1)} \biggr)^{p+ \varepsilon} \biggl(G_{A}(n)+\frac{g(n+1)}{S_{g}(n)} \biggr)^{p+ \varepsilon} .$$
(16)

Consider the function

$$h(x)=1+(1+\varepsilon ) (p+\varepsilon )x-(1+x)^{p+\varepsilon} .$$

We have $$h(0)=0$$ and $$h'(x)>0$$ for $$x\in (0,(1+\varepsilon )^{\frac{1}{p-1+\varepsilon}}-1 )$$. Hence,

$$h(x)>0\quad \text{for}\quad x\in \bigl(0,(1+\varepsilon )^{ \frac{1}{p-1+\varepsilon}}-1 \bigr) .$$

From (13) we obtain that

$$1+(1+\varepsilon ) (p+\varepsilon )\frac{g(n+1)}{G_{A}(n)S_{g}(n)}- \biggl(1+ \frac{g(n+1)}{G_{A}(n)S_{g}(n)} \biggr)^{p+\varepsilon} =h \biggl(\frac{g(n+1)}{G_{A}(n)S_{g}(n)} \biggr) >0 ,$$

hence

$$1+(1+\varepsilon ) (p+\varepsilon )\frac{g(n+1)}{G_{A}(n)S_{g}(n)}> \biggl(1+ \frac{g(n+1)}{G_{A}(n)S_{g}(n)} \biggr)^{p+\varepsilon} .$$
(17)

Inequality (9) is equivalent with

$$(1+\varepsilon ) \bigl(p-\varepsilon ^{2}\bigr)>p+ \varepsilon .$$
(18)

From (11) we have

$$t_{\varepsilon }=(1+\varepsilon )^{2p}\gamma ^{p-1+\varepsilon} >(1+ \varepsilon )^{2}\bigl((1+\varepsilon )\gamma \bigr)^{p-1+\varepsilon} >(1+ \varepsilon )^{2}G_{A}(n)^{p-1+\varepsilon} .$$
(19)

Now from (10), (12), (18), (19), and (17) multiplied by $$G_{A}(n)^{p+\varepsilon}$$ we obtain

\begin{aligned} t_{\varepsilon }F_{A}(n)+t_{\varepsilon}\frac{f(n+1)}{S_{f}(n)} &>G_{A}(n)^{p+ \varepsilon}+t_{\varepsilon}\frac{f(n+1)}{S_{f}(n)} \\ &>G_{A}(n)^{p+\varepsilon} + t_{\varepsilon}\bigl(p-\varepsilon ^{2}\bigr) \frac{g(n+1)}{S_{g}(n)} \\ &>G_{A}(n)^{p+\varepsilon}+(1+\varepsilon )^{2}\bigl(p- \varepsilon ^{2}\bigr)G_{A}(n)^{p-1+ \varepsilon} \frac{g(n+1)}{S_{g}(n)} \\ &>G_{A}(n)^{p+\varepsilon}+(1+\varepsilon ) (p+\varepsilon )G_{A}(n)^{p-1+ \varepsilon}\frac{g(n+1)}{S_{g}(n)} \\ &> \biggl(G_{A}(n)+\frac{g(n+1)}{S_{g}(n)} \biggr)^{p+\varepsilon} . \end{aligned}
(20)

Finally, from (15), from (14) multiplied by (20), and from (16) we obtain

\begin{aligned} t_{\varepsilon }F_{A}(n+1) &=\frac{S_{f}(n)}{S_{f}(n+1)} \biggl(t_{ \varepsilon }F_{A}(n)+t_{\varepsilon } \frac{f(n+1)}{S_{f}(n)} \biggr) \\ &> \biggl(\frac{S_{g}(n)}{S_{g}(n+1)} \biggr)^{p+\varepsilon} \biggl(G_{A}(n)+ \frac{g(n+1)}{S_{g}(n)} \biggr)^{p+\varepsilon} \\ &=G_{A}(n+1)^{p+\varepsilon} , \end{aligned}

i.e., (10) holds for $$n+1$$. □

In what follows, we are looking for bounds for $$\underline{d}_{f}(A)$$, $$\overline{d}_{f}(A)$$, knowing the values $$\underline{d}_{g}(A)$$ and $$\overline{d}_{g}(A)$$ and under the restriction (7).

### Theorem 3

Assume that f and g are Erdős–Ulam functions satisfying (7) and let $$A\subset \mathbb{N}$$. Then,

1. 1)

in the case $$\overline{d}_{g}(A)>0$$ we have

$$\underline{d}_{f}(A)\ge \frac{\underline{d}_{g}(A)^{p}}{\overline{d} _{g}(A)^{p-1}} ,$$
(21)
2. 2)

in the case $$\underline{d}_{g}(A)<1$$ we have

$$\overline{d}_{f}(A)\le 1- \frac{(1-\overline{d}_{g}(A))^{p}}{(1-\underline{d} _{g}(A))^{p-1}} .$$
(22)

### Proof

First, we prove part 1. If $$\underline{d}_{g}(A)=0$$ then (21) is satisfied as the right-hand side of (21) is zero.

Hence, assume $$\underline{d}_{g}(A)>0$$. Then, for every $$\varepsilon >0$$ with $$1+\varepsilon +\varepsilon ^{2}< p$$, Lemma 4 implies

\begin{aligned} \underline{d}_{f}(A) &= \liminf_{n\to \infty} F_{A}(n)\ge \liminf_{n \to \infty} \frac{G_{A}(n)^{p+\varepsilon}}{t_{\varepsilon}} \\ &= \frac{\underline{d}_{g}(A)^{p+\varepsilon}}{(1+\varepsilon )^{2p}\overline{d}_{g}(A)^{p-1+\varepsilon}} =\frac{1}{(1+\varepsilon )^{2p}} \biggl( \frac{\underline{d}_{g}(A)}{\overline{d}_{g}(A)} \biggr)^{p+\varepsilon} \overline{d}_{g}(A) . \end{aligned}

From this we obtain

$$\underline{d}_{f}(A)\ge \limsup_{\varepsilon \to 0+} \frac{1}{(1+\varepsilon )^{2p}} \biggl( \frac{\underline{d}_{g}(A)}{\overline{d}_{g}(A)} \biggr)^{p+\varepsilon} \overline{d}_{g}(A) = \frac{\underline{d}_{g}(A)^{p}}{\overline{d}_{g}(A)^{p-1}} .$$

Part 2 follows from part 1 applied to the set $$\mathbb{N}\setminus A$$, using the complementary property (3). □

Theorem 3 has the following immediate consequence.

### Corollary 1

Assume that f and g are Erdős–Ulam functions satisfying (7). Then, the densities $$d_{f}$$ and $$d_{g}$$ are equivalent.

### Proof

This follows from inequalities (8), (21), and (22). □

### Corollary 2

Assume that f and g are Erdős–Ulam functions satisfying (7) and let $$A\subset \mathbb{N}$$. Then, we have

1. 1.

$$\underline{d}_{f}(A)=0$$ if and only if $$\underline{d}_{g}(A)=0$$,

2. 2.

$$\overline{d}_{f}(A)=1$$ if and only if $$\overline{d}_{g}(A)=1$$.

### Proof

This follows from inequalities (8), (21), and (22). □

Next, we show that the bounds (21) and (22) are essentially the best possible.

### Theorem 4

Assume that f and g are Erdős–Ulam functions satisfying (7). Let numbers α, β, γ, δ be given so that

$$0\le \alpha \le \beta \le \gamma \le \delta \le 1$$
(23)

with

$$\alpha \ge \frac{\beta ^{p}}{\gamma ^{p-1}} \quad \textit{if }\gamma >0 ,$$
(24)

and with

$$1-\delta \ge \frac{(1-\gamma )^{p}}{(1-\beta )^{p-1}} \quad \textit{if }\beta < 1 .$$
(25)

Then, there exists a set $$A\subset \mathbb{N}$$ such that

$$\underline{d}_{f}(A)=\alpha ,\qquad \underline{d}_{g}(A)= \beta ,\qquad \overline{d}_{g}(A)=\gamma ,\qquad \overline{d}_{f}(A)=\delta .$$

In the case $$\gamma =0$$, inequalities (23) imply that we have $$\alpha =0$$ instead of (24). Similarly, in the case $$\beta =1$$, inequalities (23) imply that we have $$\delta =1$$ instead of (25).

### Lemma 5

Let f be an Erdős–Ulam function and $$L< M$$ be positive integers. Assume that $$T,U\subset \mathbb{N}$$ satisfy $$\chi _{T}(n)=\chi _{U}(n)$$ for every n with $$L< n\le M$$. Then, for every n with $$L< n\le M$$ we have

\begin{aligned}& F_{T}(n)\ge \min \bigl\{ F_{U}(n),F_{U}(n) +F_{T}(L)-F_{U}(L) \bigr\} , \\& F_{T}(n)\le \max \bigl\{ F_{U}(n),F_{U}(n) +F_{T}(L)-F_{U}(L) \bigr\} . \end{aligned}

### Proof

See Lemma 3 in [12]. □

### Lemma 6

Let f be an Erdős–Ulam function. Then, for every $$\alpha \in [0,1]$$ there is a set $$T\subset \mathbb{N}$$ such that $$d_{f}(T)=\alpha$$.

### Proof

This immediately follows from Proposition 1 of [14]. □

### Proof of Theorem 4

In the case that $$\beta =\gamma$$ we have from (23), (24), and (25) that $$\alpha =\beta =\gamma =\delta$$. By Lemma 6 there exists a set $$A\subset \mathbb{N}$$ such that $$d_{f}(A)=\alpha$$. For such a set by Lemma 2 we have $$d_{g}(A)=\alpha$$ and we are done.

Hence, in the rest of the proof assume that $$\beta <\gamma$$.

To generate the set A, we construct two sequences of sets with different weighted densities, and then we interleave them. First, take sequences of real numbers $$\beta _{i}$$, $$\gamma _{i}$$ for $$i\ge 0$$, such that

$$\beta < \beta _{i}< \gamma _{i}< \gamma$$

such that

$$\lim_{i\to \infty}\beta _{i}=\beta ,\qquad \lim _{i\to \infty} \gamma _{i}=\gamma .$$

Put

$$s_{i}=\textstyle\begin{cases} \sqrt[p-1]{\frac{\beta _{i}^{p}}{\alpha}}&\text{if }\alpha \neq 0, \\ \beta _{i}&\text{if }\alpha =0 \end{cases}\displaystyle \quad \text{and}\quad r_{i}=\textstyle\begin{cases} 1-\sqrt[p-1]{\frac{(1-\gamma _{i})^{p}}{1-\delta _{i}}}&\text{if } \delta \neq 1, \\ \gamma _{i}&\text{if }\delta =1 . \end{cases}$$
(26)

According to (24)

$$\alpha < \beta _{i}\le s_{i} \quad \text{and}\quad \beta \leq \lim_{i \to \infty} s_{i}\leq \gamma$$
(27)

and from (25)

$$r_{i}\leq \gamma _{i}< \delta \quad \text{and}\quad \beta \leq \lim_{i \to \infty} r_{i}\leq \gamma .$$
(28)

Again, by Lemma 6 there exist sets $$B_{i}$$ and $$C_{i}$$ of positive integers such that

$$d_{f}(B_{i})=s_{i} \quad \text{and}\quad d_{f}(C_{i})=r_{i} .$$
(29)

Note that by (8) in this case

$$d_{g}(B_{i})=s_{i} \quad \text{and}\quad d_{g}(C_{i})=r_{i} .$$
(30)

As the limits (29) and (30) exist, for every $$\varepsilon>0$$ there are numbers $$N_{6}(i,\varepsilon )$$, such that

\begin{aligned}& s_{i}-\varepsilon < F_{B_{i}}(n)< s_{i}+\varepsilon , \\& r_{i}-\varepsilon < F_{C_{i}}(n)< r_{i}+\varepsilon , \\& s_{i}-\varepsilon < G_{B_{i}}(n)< s_{i}+\varepsilon , \\& r_{i}-\varepsilon < G_{C_{i}}(n)< r_{i}+\varepsilon \end{aligned}

for every $$n>N_{6}(i,\varepsilon )$$.

As f is an Erdős–Ulam function, from limit (2) we obtain that for every $$\varepsilon >0$$ there is a number $$N_{7}(\varepsilon )$$ such that for every $$k\ge N_{7}(\varepsilon )$$ we have $$f^{*}(k)<\varepsilon$$.

Let $$(\varepsilon _{i} )$$ be a decreasing sequence tending to 0 with

$$\varepsilon _{i}< \min \biggl\{ \frac{\beta _{i}-\alpha}{2}, \frac{\delta -\gamma _{i}}{2} \biggr\} .$$
(31)

We will define inductively the sequence $$(n_{l})$$ and the set $$A\subset \mathbb{N}$$ by

\begin{aligned} A&=\bigcup_{i =0}^{\infty } ( ((n_{4i },n_{4i +1}] \cap B_{i} ) \cup ((n_{4i+1},n_{4i+2}]\cap \emptyset ) \\ &\quad{}\cup ((n_{4i +2},n_{4i +3}]\cap C_{i} ) \cup \bigl((n_{4i +3},n_{4i +4}]\cap \mathbb{N} ) \bigr) . \end{aligned}

(We take a sufficiently large section of $$B_{i}$$ on interval $$(n_{4i },n_{4i +1}]$$ such that $$F_{A}(n_{4i +1})$$ and $$G_{A}(n_{4i +1})$$ are close to $$s_{i}$$. The interval $$(n_{4i +1},n_{4i +2}]$$ is as short as possible such that at its end, $$f_{A}(n_{4i +2})$$ is close to α. It is followed by a sufficiently long section of $$C_{i}$$ on interval $$(n_{4i+2},n_{4i+3}]$$ such that $$F_{A}(n_{4i +3})$$ and $$G_{A}(n_{4i +3})$$ are close to $$r_{i}$$. Finally, the interval $$(n_{4i +3},n_{4i +4}]$$ is as short as possible such that at its end, $$F_{A}(n_{4i +4})$$ is close to δ.)

For $$n\in \mathbb{N}$$ we denote $$D_{n}=A\cap [1,n]$$.

Suppose that we have already fixed the numbers $$n_{0}=0, n_{1}, \dots , n_{4i }$$. We give the construction of the next four terms of the sequence $$(n_{l})$$:

• $$n_{4i +1}$$: Although we do not know the set A yet, the set $$D_{n_{4i}}$$ is well defined and already known. From (29) we obtain

$$\lim_{u\to \infty} F_{D_{n_{4i}}\cup ((n_{4i},u]\cap B_{i})}(u) = \lim _{u\to \infty} F_{B_{i}}(u) =s_{i}$$
(32)

and similarly from (30) we obtain

$$\lim_{u\to \infty} G_{D_{n_{4i}}\cup ((n_{4i},u]\cap B_{i})}(u) = \lim _{u\to \infty} G_{B_{i}}(u) =s_{i} .$$
(33)

Take $$n_{4i+1}$$ to be the smallest integer satisfying

\begin{aligned}& n_{4i+1}\ge \max \bigl\{ n_{4i}+1,N_{1}(\varepsilon _{i}), N_{6}(i, \varepsilon _{i}) , N_{7}(\varepsilon _{i}) \bigr\} , \end{aligned}
(34)
\begin{aligned}& s_{i}-\varepsilon _{i}< F_{D_{n_{4i}}\cup ((n_{4i},n_{4i+1}]\cap B_{i})}(n_{4i+1}) < s_{i}+\varepsilon _{i}, \end{aligned}
(35)
\begin{aligned}& s_{i}-\varepsilon _{i}< G_{D_{n_{4i}}\cup ((n_{4i},n_{4i+1}]\cap B_{i})}(n_{4i+1}) < s_{i}+\varepsilon _{i}, \end{aligned}
(36)

where $$N_{1}(\varepsilon )$$ is given by Lemma 3. Such a number $$n_{4i+1}$$ exists by (32) and (33).

• $$n_{4i +2}$$: Although we do not know the set A yet, the set $$D_{n_{4i+1}}$$ is well defined and already known. Obviously,

$$\lim_{u\to \infty} F_{D_{n_{4i+1}}\cup ((n_{4i+1},u]\cap \emptyset )}(u) =0 .$$
(37)

Take $$n_{4i+2}$$ to be the smallest integer satisfying

\begin{aligned}& n_{4i+2}> n_{4i+1}, \\& F_{D_{n_{4i+1}}\cup ((n_{4i+1},n_{4i+2}]\cap \emptyset )}(n_{4i+2}) < \alpha +\varepsilon _{i}. \end{aligned}

Such a number $$n_{4i+2}$$ exists by (27), (31), (35), and (37).

Since $$n_{4i+2}>N_{7}(\varepsilon _{i})$$ then by Lemma 1

$$\alpha < F_{D_{n_{4i+1}}\cup ((n_{4i+1},n_{4i+2}]\cap \emptyset )}(n_{4i+2}) < \alpha +\varepsilon _{i} .$$
(38)
• $$n_{4i+3}$$: Although we do not know the set A yet, the set $$D_{n_{4i+2}}$$ is well defined and already known. From (29) we obtain

$$\lim_{u\to \infty} F_{D_{n_{4i+2}}\cup ((n_{4i+2},u]\cap C_{i})}(u) = \lim _{u\to \infty} F_{C_{i}}(u) =r_{i}$$
(39)

and similarly from (30) we obtain

$$\lim_{u\to \infty} G_{D_{n_{4i+2}}\cup ((n_{4i+2},u]\cap C_{i})}(u) = \lim _{u\to \infty} G_{C_{i}}(u) =r_{i}.$$
(40)

Take $$n_{4i+3}$$ to be the smallest integer satisfying

\begin{aligned}& n_{4i+3}\ge \max \bigl\{ n_{4i+2}+1, N_{6}(i+1, \varepsilon _{i+1}) \bigr\} , \end{aligned}
(41)
\begin{aligned}& r_{i}-\varepsilon _{i}< F_{D_{n_{4i+2}}\cup ((n_{4i+2},n_{4i+3}]\cap C_{i})}(n_{4i+3}) < r_{i}+\varepsilon _{i}, \end{aligned}
(42)
\begin{aligned}& r_{i}-\varepsilon _{i} < G_{D_{n_{4i+2}}\cup ((n_{4i+2},n_{4i+3}] \cap C_{i})}(n_{4i+3}) < r_{i}+\varepsilon _{i} . \end{aligned}
(43)

Such a number $$n_{4i+3}$$ exists by (39) and (40).

• $$n_{4i +4}$$: Although we do not know the set A yet, the set $$D_{n_{4i+3}}$$ is well defined and already known. Obviously,

$$\lim_{u\to \infty} F_{D_{n_{4i+3}}\cup ((n_{4i+3},u]\cap \mathbb{N})}(u) =1 .$$
(44)

Take $$n_{4i+4}$$ to be the smallest integer satisfying

\begin{aligned}& n_{4i+4}>n_{4i+3}, \\& F_{D_{n_{4i+3}}\cup ((n_{4i+3},n_{4i+4}]\cap \mathbb{N})}(n_{4i+4}) > \delta -\varepsilon _{i}. \end{aligned}

Such a number $$n_{4i+2}$$ exists by (28), (31), (42), and (44).

Since $$n_{4i+2}>N_{7}(\varepsilon _{i})$$ then by Lemma 1

$$\delta -\varepsilon _{i} < F_{D_{n_{4i+3}}\cup ((n_{4i+3},n_{4i+4}] \cap \mathbb{N})}(n_{4i+4}) < \delta .$$
(45)

Now, we know the set A completely and we can rewrite conditions (35), (36), (38), (42), (43), and (45) equivalently in a simpler way as

\begin{aligned}& s_{i}-\varepsilon _{i}< F_{A}(n_{4i+1}) < s_{i}+\varepsilon _{i}, \end{aligned}
(46)
\begin{aligned}& s_{i}-\varepsilon _{i}< G_{A}(n_{4i+1}) < s_{i}+\varepsilon _{i}, \end{aligned}
(47)
\begin{aligned}& \alpha < F_{A}(n_{4i+2})< \alpha +\varepsilon _{i}, \end{aligned}
(48)
\begin{aligned}& r_{i}-\varepsilon _{i}< F_{A}(n_{4i+3}) < r_{i}+\varepsilon _{i}, \end{aligned}
(49)
\begin{aligned}& r_{i}-\varepsilon _{i}< G_{A}(n_{4i+3})< r_{i}+\varepsilon _{i}, \end{aligned}
(50)
\begin{aligned}& \delta -\varepsilon _{i} < F_{A}(n_{4i+4})< \delta . \end{aligned}
(51)

We will show that

\begin{aligned}& \lim_{i\to \infty }G_{A}(n_{4i+2})=\beta , \end{aligned}
(52)
\begin{aligned}& \lim_{i\to \infty }G_{A}(n_{4i+4})=\gamma . \end{aligned}
(53)

In proving (52), we will consider two cases.

• If $$\alpha >0$$, then by Lemma 3 and (34)

\begin{aligned} G_{A}(n_{4i+2})&= \frac{G_{A}(n_{4i+1})S_{g}(n_{4i+1})}{S_{g}(n_{4i+2})} < G_{A}(n_{4i+1}) \biggl( \frac{S_{f}(n_{4i+1})}{S_{f}(n_{4i+2})} \biggr)^{ \frac{1}{p+\varepsilon _{i}}} \\ &=G_{A}(n_{4i+1}) \frac{ ( \frac{F_{A}(n_{4i+1})S_{f}(n_{4i+1})}{S_{f}(n_{4i+2})} )^{\frac{1}{p+\varepsilon _{i}}} }{ (F_{A}(n_{4i+1}) )^{\frac{1}{p+\varepsilon _{i}}} } \\ &=G_{A}(n_{4i+1}) \biggl(\frac{F_{A}(n_{4i+2})}{F_{A}(n_{4i+1})} \biggr)^{\frac{1}{p+\varepsilon _{i}}} . \end{aligned}

By (46), (47), and (48)

$$G_{A}(n_{4i+2})< \frac{(s_{i}+\varepsilon _{i})}{(s_{i}-\varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}}}( \alpha + \varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}} .$$
(54)

Similarly, we can show that

$$G_{A}(n_{4i+2})> \frac{(s_{i}-\varepsilon _{i})}{(s_{i}+\varepsilon _{i})^{\frac{1}{p-\varepsilon _{i}}}} \alpha ^{\frac{1}{p-\varepsilon _{i}}} .$$
(55)

According to (26)

\begin{aligned} \lim_{i\to \infty} \frac{(s_{i}+\varepsilon _{i})}{(s_{i}-\varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}}}( \alpha +\varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}}&=\lim_{i \to \infty}s_{i}^{\frac{p-1}{p}} \alpha ^{\frac{1}{p}} \\ &=\lim_{i\to \infty} \biggl( \biggl(\frac{\beta _{i}^{p}}{\alpha} \biggr)^{\frac{1}{p-1}} \biggr)^{\frac{p-1}{p}}\alpha ^{\frac{1}{p}}= \lim _{i\to \infty}\beta _{i}=\beta \end{aligned}

and

$$\lim_{i\to \infty} \frac{(s_{i}-\varepsilon _{i})}{(s_{i}+\varepsilon _{i})^{\frac{1}{p-\varepsilon _{i}}}} \alpha ^{\frac{1}{p-\varepsilon _{i}}}=\beta .$$

Then, (54) and (55) imply (52).

• If $$\alpha =0$$, then also $$\beta =0$$ by Corollary 2. Obviously,

$$0< G_{A}(n_{4i+2})< G_{A}(n_{4i+1})< s_{i}+ \varepsilon _{i}=\beta _{i}+ \varepsilon _{i} .$$

Since $$\lim_{i\to \infty}\beta _{i}=\beta =0$$ then,

$$\lim_{i\to \infty}G_{A}(n_{4i+2})=0=\beta .$$

Similarly in proving (53), we will consider two cases.

• If $$\delta <1$$, then by Lemma 3 and (41)

\begin{aligned} G_{A}(n_{4i+4})&= \frac{G_{A}(n_{4i+3})S_{g}(n_{4i+3})+S_{g}(n_{4i+4})-S_{g}(n_{4i+3})}{S_{g}(n_{4i+4})} \\ &=1-\bigl(1-G_{A}(n_{4i+3})\bigr)\frac{S_{g}(n_{4i+3})}{S_{g}(n_{4i+4})} \\ &< 1-\bigl(1-G_{A}(n_{4i+3})\bigr) \biggl( \frac{S_{f}(n_{4i+3})}{S_{f}(n_{4i+4})} \biggr)^{ \frac{1}{p-\varepsilon _{i}}} \\ &=1- \frac{(1-G_{A}(n_{4i+3}))}{(1-F_{A}(n_{4i+3}))^{\frac{1}{p-\varepsilon _{i}}}} \biggl( \frac{(1-F_{A}(n_{4i+3}))S_{f}(n_{4i+3})}{S_{f}(n_{4i+4})} \biggr)^{\frac{1}{p-\varepsilon _{i}}} \\ &=1-\bigl(1-G_{A}(n_{4i+3})\bigr) \biggl( \frac{1-F_{A}(n_{4i+4})}{1-F_{A}(n_{4i+3})} \biggr)^{ \frac{1}{p-\varepsilon _{i}}} . \end{aligned}

By (49), (50), and (51)

$$G_{A}(n_{4i+4})< 1- \frac{1-r_{i}-\varepsilon _{i}}{(1-r_{i}+\varepsilon _{i})^{\frac{1}{p-\varepsilon _{i}}}}(1- \delta )^{\frac{1}{p-\varepsilon _{i}}} .$$
(56)

Similarly, we can show that

$$G_{A}(n_{4i+4})>1- \frac{1-r_{i}+\varepsilon _{i}}{(1-r_{i}-\varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}}}(1- \delta +\varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}} .$$
(57)

According to (26)

\begin{aligned} &\lim_{i\to \infty} \biggl(1- \frac{1-r_{i}-\varepsilon _{i}}{(1-r_{i}+\varepsilon _{i})^{\frac{1}{p-\varepsilon _{i}}}}(1- \delta + \varepsilon _{i})^{\frac{1}{p-\varepsilon _{i}}} \biggr) \\ &\quad=1-\lim_{i\to \infty}(1-r_{i})^{\frac{p-1}{p}}(1-\delta )^{ \frac{1}{p}} \\ &\quad=1-\lim_{i\to \infty} \biggl( \biggl( \frac{(1-\gamma _{i})^{p}}{1-\delta} \biggr)^{\frac{1}{p-1}} \biggr)^{ \frac{p-1}{p}}(1-\delta )^{\frac{1}{p}}=\lim _{i\to \infty}\gamma _{i}= \gamma \end{aligned}

and

$$\lim_{i\to \infty}1- \frac{1-r_{i}+\varepsilon _{i}}{(1-r_{i}-\varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}}}(1- \delta +\varepsilon _{i})^{\frac{1}{p+\varepsilon _{i}}}=\gamma .$$

Then, (56) and (57) imply (53).

• If $$\delta =1$$, then also $$\gamma =1$$ by Corollary 2. Obviously,

$$1> G_{A}(n_{4i+4})>G_{A}(n_{4i+3})>r_{i}- \varepsilon _{i}=\gamma _{i}-\varepsilon _{i} .$$

Since $$\lim_{i\to \infty}\gamma _{i}=\gamma =1$$ then,

$$\lim_{i\to \infty}G_{A}(n_{4i+4})=1 .$$

Hence, we can proceed to calculate the lower and upper weighted densities of A. On intervals $$[n_{4i+1},n_{4i+2}]$$ and $$[n_{4i+3},n_{4i+4}]$$ the functions $$F_{A}(n)$$ and $$G_{A}(n)$$ are monotone. For $$u\in (n_{4i+2},n_{4i+3}]$$, condition (34) and Lemma 5 with $$T=A$$ and $$U=C_{i}$$ imply that

\begin{aligned} G_{A}(u)&\ge \min \bigl\{ G_{C_{i}}(u),G_{C_{i}}(u) +G_{A}(n_{4i+2})-G_{C_{i}}(n_{4i+2}) \bigr\} \\ &\ge \min \bigl\{ r_{i}-\varepsilon _{i},G_{A}(n_{4i+2})-2 \varepsilon _{i} \bigr\} , \end{aligned}

hence, by (48) we have

$$\liminf_{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i+2},n_{4i+3}] }} G_{A}(u) \ge \liminf _{i\to \infty} \min \{r_{i}, \beta \}=\beta .$$

Similarly,

\begin{aligned} G_{A}(u)&\le \max \bigl\{ G_{C_{i}}(u),G_{C_{i}}(u) +G_{A}(n_{4i+2})-G_{C_{i}}(n_{4i+2}) \bigr\} \\ &\le \max \bigl\{ r_{i}+\varepsilon _{i},G_{A}(n_{4i+2})+2 \varepsilon _{i} \bigr\} , \end{aligned}

and

$$\limsup_{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i+2},n_{4i+3}] }} G_{A}(u) \le \limsup _{i\to \infty} \max \{r_{i}, \beta \}\le \gamma .$$

In the same way we can prove that

\begin{aligned}& \beta \le \liminf_{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i},n_{4i+1}] }} G_{A}(u) \le \limsup _{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i},n_{4i+1}] }} G_{A}(u) \le \gamma , \\& \alpha \le \liminf_{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i+2},n_{4i+3}] }} F_{A}(u) \le \limsup _{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i+2},n_{4i+3}] }} F_{A}(u) \le \delta , \\& \alpha \le \liminf_{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i},n_{4i+1}] }} F_{A}(u) \le \limsup _{ \substack{u\to \infty \\ u\in \bigcup _{i=0}^{\infty }(n_{4i},n_{4i+1}] }} F_{A}(u) \le \delta . \end{aligned}

As a consequence, to calculate the densities it is sufficient to consider the functions $$F_{A}(n)$$ and $$G_{A}(n)$$ only in numbers $$n_{4i +2}$$ and $$n_{4i +4}$$. By (48), (51), (52), and (53)

\begin{aligned}& \lim_{i\to \infty} F_{A}(n_{4i +2})=\alpha ,\qquad \lim_{i\to \infty} F_{A}(n_{4i +4})=\delta , \\& \lim_{i\to \infty} G_{A}(n_{4i +2})=\beta ,\qquad \lim_{i\to \infty} G_{A}(n_{4i +4})=\gamma . \end{aligned}

This concludes the proof. □

## 5 The case $$\frac{f^{*}(n)}{g^{*}(n)}\to 1$$

### Theorem 5

Assume that f and g are Erdős–Ulam functions satisfying

$$\lim_{n\to \infty} \frac{f^{*}(n)}{g^{*}(n)}= 1 .$$
(58)

Then, the densities $$d_{f}$$ and $$d_{g}$$ are strongly equivalent.

### Proof

We have to prove that for every set $$A\subset \mathbb{N}$$ we have $$\underline{d}_{f}(A)=\underline{d}_{g}(A)$$. For a contradiction, suppose without loss of generality that there is some set $$A\subset \mathbb{N}$$ such that $$\underline{d}_{f}(A)=\alpha$$ and $$\underline{d}_{g}(A)=\beta$$ for some $$0\le \alpha <\beta \le 1$$.

Take $$p>1$$ such that $$\beta ^{p}>\alpha$$. Such a p exists because of continuity. Construct a function $$h\colon \mathbb{N}\to \mathbb{R}^{+}$$ by

\begin{aligned} &h(1)=1 , \\ &h(n)=S_{g}(n)^{p}-S_{g}(n-1)^{p} \quad \text{for }n\ge 2 . \end{aligned}

It follows that $$S_{h}(n)=S_{g}(n)^{p}$$, hence,

$$\lim_{n\to \infty}S_{h}(n)=\lim_{n\to \infty} S_{g}(n)^{p}=\infty$$

and limit (2) for function g implies that

$$\lim_{n\to \infty}h^{*}(n)=\lim_{n\to \infty} \frac{S_{g}(n)^{p}-S_{g}(n-1)^{p}}{S_{g}(n)^{p}} =\lim_{n\to \infty} \bigl(1-\bigl(1-g^{*}(n) \bigr)^{p} \bigr)=0 .$$

Thus, h is an Erdős–Ulam function. Using l’Hospital’s rule we obtain

$$\lim_{n\to \infty}\frac{h^{*}(n)}{g^{*}(n)}=\lim _{n\to \infty} \frac{1-(1-g^{*}(n))^{p}}{g^{*}(n)}=p .$$
(59)

Theorem 3 implies that the corresponding weighted density $$\underline{d}_{h}$$ satisfies

$$\underline{d}_{h}(A)\ge \frac{\underline{d}_{g}(A)^{p}}{\overline{d}_{g}(A)^{p-1}}\ge \underline{d}_{g}(A)^{p}= \beta ^{p}>\alpha .$$
(60)

On the other hand, from (58) and (59) we obtain

$$\lim_{n\to \infty}\frac{h^{*}(n)}{f^{*}(n)}=p$$

and Lemma 2 with (60) imply that

$$\underline{d}_{h}(A)\le \underline{d}_{f}(A)=\alpha ,$$

## 6 The case $$\frac{f^{*}(n)}{g^{*}(n)}\to \infty$$

Let us consider the following example from [12]. Let $$f(n)=2+(-1)^{n}$$ and $$g(n)=\frac {1}{n}$$, $$n=1,2,\dots$$. Then, $$\frac{f^{*}(n)}{g^{*}(n)}\to \infty$$ as $$n\to \infty$$, but $$d_{f}(2\mathbb{N})=\frac{3}{4}$$ and $$d_{g}(2\mathbb{N})=\frac{1}{2}$$. Consequently, $$d_{f}$$ and $$d_{g}$$ are not comparable densities.

In what follows we shall consider Erdős–Ulam functions that are monotone. We call an Erdős–Ulam function f regular if the corresponding weighted density fulfils the condition that for arbitrary positive integers a, b we have $$d_{f}(a\mathbb{N}+b) =\frac{1}{a}$$ (f-density of the terms of arbitrary infinite arithmetical progression with the same difference are equal). It is not difficult to show that a monotone Erdős–Ulam function is regular (see, e.g., [5], Example 2.1).

The independence (within admissible bounds) of the asymptotic and logarithmic densities was proved in [15] and [16], by showing that for any given real numbers $$0\le \alpha \le \beta \le \gamma \le \delta \le 1$$ there exists a set $$A\subset N$$ such that

$$\underline{d}_{1}(A)=\alpha , \qquad \underline{d}_{\frac {1}{n}}(A)= \beta , \qquad \overline{d}_{\frac {1}{n}}(A)=\gamma , \qquad \overline{d}_{1}(A)=\delta .$$

We generalize this result.

### Theorem 6

Let monotone Erdős–Ulam functions f and g satisfy the condition $$\frac{f^{*}(n)}{g^{*}(n)}\to \infty$$ as $$n\to \infty$$. Then, for any given real numbers

$$0\le \alpha \le \beta \le \gamma \le \delta \le 1$$

there exists a set $$A\subset N$$ such that

$$\underline{d}_{f}(A)=\alpha , \qquad \underline{d}_{g}(A)= \beta , \qquad \overline{d}_{g}(A)=\gamma , \qquad \overline{d}_{f}(A)=\delta .$$

### Proof

By Theorem 1 from [17] it is sufficient to consider only the “worst” case, i.e., it is sufficient to show the existence of an $$A\subset \mathbb{N}$$, for that

$$\underline{d}_{f}(A)=0, \qquad \overline{d}_{f}(A)=1, \qquad d_{g}(A)=0 .$$

Using (6), it can be showed by the Stolz–Cesàro theorem that under the assumption of the theorem $$\frac{\ln S_{f}(n)}{\ln S_{g}(n)}\to \infty$$ as $$n\to \infty$$. This is equivalent to

$$S_{f}(n)=S_{g}(n)^{\psi (n)}, \quad \text{where } \psi (n)\to \infty \quad \text{as}\quad n\to \infty .$$
(61)

Let $$(\varepsilon _{i} )$$ be a decreasing sequence that tends to 0, where $$\varepsilon _{1}<1$$. Now, we define inductively the sequence

$$n_{1}< m_{1}< n_{2}< m_{2}< \cdots$$

and the set A by

$$A=\bigcup_{i=1}^{\infty }(n_{i},m_{i}] \cap \mathbb{N} .$$
(62)

Let $$n_{1}=0$$ and let $$m_{1}$$ be some positive integer such that $$S_{g}(m_{1})\ge 1$$. Suppose that we have already fixed the numbers $$n_{i-1}$$, $$m_{i-1}$$, where $$i\ge 2$$.

Choose a positive integer $$n_{i} > m_{i-1}$$ such that (63)–(66) hold

\begin{aligned}& \frac{S_{f}(m_{i-1})}{S_{f}(n_{i})} < \varepsilon _{i}^{2}, \qquad \frac{S_{g}(m_{i-1})}{S_{g}(n_{i})} < \varepsilon _{i}^{2}, \end{aligned}
(63)
\begin{aligned}& 1-\varepsilon _{i} < \sqrt[\psi (n_{i})]{\varepsilon _{i}-\varepsilon _{i}^{2}} . \end{aligned}
(64)

Further, for all $$k \ge n_{i}$$

\begin{aligned}& \psi (k)\ge \psi (n_{i}) , \end{aligned}
(65)
\begin{aligned}& \frac{S_{f}(k)}{S_{f}(k+1)}>1-\varepsilon _{i} . \end{aligned}
(66)

The existence of such a number $$n_{i}$$ follows from (1), (4), and (61).

Now, let $$m_{i}$$ be the smallest positive integer with $$m_{i}>n_{i}$$ and

$$\varepsilon _{i}-\varepsilon _{i}^{2}< \frac{S_{f}(n_{i})}{S_{f}(m_{i})}< \varepsilon _{i} .$$
(67)

The existence of such a number $$m_{i}$$ follows from (1) and (66).

In the following, we prove that the set A we have created by (62) has the desired lower and upper weighted densities. From (63) we directly obtain

$$\underline{d}_{f}(A)=\underline{d}_{g}(A)=0 .$$

From (67) we obtain

\begin{aligned} 1&\ge \overline{d}_{f}(A)\ge \limsup_{i\to \infty} \frac{\sum_{j=1}^{m_{i}} f(j)\chi _{A}(j)}{S_{f}(m_{i})} \ge \limsup_{i\to \infty} \frac{S_{f}(m_{i})-S_{f}(n_{i})}{S_{f}(n_{i})} \\ &\ge \lim_{i\to \infty}(1-\varepsilon _{i})=1 . \end{aligned}

In order to prove $$\overline{d}_{g}(A)=0$$ we estimate the values $$G_{A}(m_{i})$$. From (65) we obtain $$\psi (m_{i})\ge \psi (n_{i})$$ and with (61) and (67) this implies that

$$\biggl(\frac{S_{g}(n_{i})}{S_{g}(m_{i})} \biggr)^{\psi (n_{i})} \ge \frac{S_{g}(n_{i})^{\psi (n_{i})}}{S_{g}(m_{i})^{\psi (m_{i})}}= \frac{S_{f}(n_{i})}{S_{f}(m_{i})}>\varepsilon _{i}-\varepsilon _{i}^{2} .$$

From this, according to (64) we have

$$\frac{S_{g}(n_{i})}{S_{g}(m_{i})} >1-\varepsilon _{i} .$$
(68)

From (63) and (68) we obtain

$$G_{A}(m_{i})\le \frac{S_{g}(m_{i-1})+ S_{g}(m_{i})-S_{g}(n_{i})}{S_{g}(m_{i})}< \varepsilon _{i}^{2}+1-(1-\varepsilon _{i})=\varepsilon _{i}^{2}+ \varepsilon _{i} ,$$

which implies that

$$\overline{d}_{g}(A) = \limsup_{i\to \infty} G_{A}(m_{i})\le \limsup_{i \to \infty} \bigl( \varepsilon _{i}^{2}+\varepsilon _{i}\bigr)=0$$

and this concludes the proof. □

### Remark 1

Let us define

$$S_{f_{k}}(n)=e^{\sqrt[k]{\ln n} } , \quad k=1,2,\dots$$

and by them the Erdős–Ulam functions $$f_{k}(n)$$. Putting $$g_{k}(x)=\sqrt[k]{\ln x}$$ we obtain

$$g'_{k}(x)=\frac{1}{kx(\ln x)^{1-\frac{1}{k}}}$$

and the Lagrange mean value theorem implies that

\begin{aligned} f^{*}_{k}(n)&=1-\frac{S_{f_{k}}(n-1)}{S_{f_{k}}(n)} =1-e^{g_{k}(n-1)-g_{k}(n)} =1-e^{-g'_{k}(\xi _{k,n})} \\ &\sim g'_{k}(\xi _{k,n}) \sim g'_{k}(n) = \frac{1}{kn(\ln n)^{1-\frac{1}{k}}}, \end{aligned}
(69)

where $$\xi _{k,n}\in (n-1,n)$$. It follows from Rajagopal’s result that $$d_{f_{k}}$$ is stronger than $$d_{f_{k+1}}$$ for any k. Since $$\frac{f^{*}_{k}(n)}{f^{*}_{k+1}(n)}\to \infty$$ as $$n\to \infty$$ by Theorem 4 it follows that the weight density $$d_{f_{k}}$$ is not equivalent to $$d_{f_{k+1}}$$. Note that $$d_{f_{1}}$$ corresponds to the asymptotic density. For the logarithmic density $$d_{\frac{1}{n}}$$ we have

$$\biggl(\frac{1}{n} \biggr)^{*}\sim \frac{1}{n\ln n}$$

and from (69) it follows that each of the densities $$d_{f_{k}}$$ is stronger than the logarithmic density. Hence, between the asymptotic density and the logarithmic one there are infinitely many $$d_{f_{k}}$$ ($$k=2,3, \dots$$) densities, each of them is stronger than the logarithmic density and weaker than the asymptotic density.

Not applicable.

## References

1. Alexander, R.: Density and multiplicative structure of sets of integers. Acta Arith. 12, 321–332 (1967)

2. Rohrbach, H., Volkmann, B.: Verallgemeinerte asymptotische dichten. J. Reine Angew. Math. 194, 195–209 (1955)

3. Giuliano, R., Grekos, G., Mišík, L.: Open problems on densities ii. In: Komatsu, T. (ed.) Diophantine Analysis and Related Fields 2010, Proceedings of the conference DARF 2010, Musashino, Tokyo, Japan, March 4–5, 2010. AIP Conference Proceedings, vol. 1264, pp. 114–128. American Institute of Physics (AIP), Melville (2010)

4. Kuipers, L., Niederreiter, H.: Uniform Distribution of Sequences. Dover Books on Mathematics. Dover, New York (2012)

5. Bukor, J., Mišík, L., Tóth, J.T.: Dependence of densities on a parameter. Inf. Sci. 179(17), 2903–2911 (2009)

6. Antonini, R.G., Grekos, G., Mišík, L.: On weighted densities. Czechoslov. Math. J. 57(3), 947–962 (2007)

7. Grekos, G.: On various definitions of density (survey). Tatra Mt. Math. Publ. 31(2), 17–27 (2005)

8. Sleziak, M., Ziman, M.: Range of density measures. Acta Math. Univ. Ostrav. 17, 33–50 (2009)

9. Rajagopal, C.T.: Some limit theorems. Am. J. Math. 70(1), 157–166 (1948)

10. Hardy, G.H.: Divergent Series. Oxford University Press, Oxford (1949)

11. Massé, B., Schneider, D.: A survey on weighted densities and their connection with the first digit phenomenon. Rocky Mt. J. Math. 41(5), 1395–1415 (2011)

12. Bukor, J., Filip, F., Tóth, J.T.: Sets with countably infinitely many prescribed weighted densities. Rocky Mt. J. Math. 50(2), 467–477 (2020)

13. Bukor, J., Filip, F., Tóth, J.T.: A criterion for comparability of weighted densities. Appl. Math. Sci. (Ruse) 8(56), 2793–2799 (2014)

14. Grekos, G., Mišík, L., Tóth, J.T.: Density sets of sets of positive integers. J. Number Theory 130, 1399–1407 (2010)

15. Luca, F., Porubský, Š.: On asymptotic and logarithmic densities. Tatra Mt. Math. Publ. 31, 75–86 (2005)

16. Mišík, L.: Sets of positive integers with prescribed values of densities. Math. Slovaca 52, 289–296 (2002)

17. Bukor, J., Filip, F.: Sets with prescribed lower and upper weighted densities. Acta Univ. Sapientiae Math. 2, 92–98 (2010)

## Acknowledgements

Work on this paper was supported by grant VEGA no. 1/0776/21 and the Pallas Athéné Domus Meriti Foundation. The authors would like to thank the anonymous referee for his valuable comments.

Not applicable.

## Author information

Authors

### Contributions

All authors contributed equally and significantly in this manuscript, and they read and approved the final manuscript.

### Corresponding author

Correspondence to Ferdinánd Filip.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

## Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and permissions

Bukor, J., Filip, F., Šustek, J. et al. Comparing weighted densities. J Inequal Appl 2022, 146 (2022). https://doi.org/10.1186/s13660-022-02885-y