61

What proportion of positive integers have two factors that differ by 1?

This question occurred to me while trying to figure out why there are 7 days in a week.

I looked at 364, the number of days closest to a year (there are about 364.2422 days in a year, iirc). Since $364 = 2\cdot 2 \cdot 7 \cdot 13$, the number of possible number that evenly divide a year are 2, 4, 7, 13, 14, 26, 28, and larger.

Given this, 7 looks reasonable - 2 and 4 are too short and 13 is too long.

Anyway, I noticed that 13 and 14 are there, and wondered how often this happens.

I wasn't able to figure out a nice way to specify the probability (as in a Hardy-Littlewood product), and wasn't able to do it from the inverse direction (i.e., sort of a sieve with n(n+1) going into the array of integers).

Ideally, I would like an asymptotic function f(x) such that $\lim_{n \to \infty} \dfrac{\text{number of such integers } \ge 2 \le nx}{n} =f(x) $ or find $c$ such that $\lim_{n \to \infty} \dfrac{\text{number of such integers } \ge 2 \le n}{n} =c $.

My guess is that, in the latter case, $c = 0$ or $1$, but I have no idea which is true. Maybe its $1-\frac1{e}$.

Note: I have modified this to not allow $1$ as a divisor.

marty cohen
  • 110,450
  • 27
    There are $365.2425$ days per year on average when taking leap year into account. – JMoravitz Dec 13 '18 at 23:23
  • 4
    A list of such numbers can be found at https://oeis.org/A088723 – Dan Dec 14 '18 at 05:04
  • 4
    I presume this doesn't constitute an answer for what you wanted, but I wrote a program to do a brute-force count and going up to $10^6$ I find 221944 numbers with this property; or up to $10^7$ I find 2219451. Perhaps that number will give someone an idea. – David Z Dec 14 '18 at 05:34
  • 4
    History of the seven-day week (probably because it's close to 1/4 a lunar month, rather than 1/52 an astronomical year): https://en.wikipedia.org/wiki/Week#History – aschepler Dec 14 '18 at 12:47
  • 4
    Slightly better approximation: 0.22194814. I approximately measured the density in the range $[k, k+10^{10})$ where $k=345678912345678$. – Veedrac Dec 14 '18 at 16:08

2 Answers2

94

Every even number has consecutive factors: $1$ and $2$.

No odd number has, because all its factors are odd.

The probability is $1/2$.

ajotatxe
  • 66,849
  • 25
    Good point. I have become my evil twin by not allowing 1 as a divisor. To make up for this, I have upvoted you. – marty cohen Dec 14 '18 at 02:57
  • 32
    This is a much more interesting problem if one specifies '1' may not be a factor. – user121330 Dec 14 '18 at 14:42
  • 1
    OK, so now how many even numbers have N pairs? (evil grin) – Carl Witthoft Dec 14 '18 at 15:22
  • 5
    Units are normally excluded from the definition of factors. – R.. GitHub STOP HELPING ICE Dec 14 '18 at 18:31
  • 8
    @R. Not in my experience of number theory (though in more general contexts it would be reasonable). The number whose factors you're seeking, on the other hand, is excluded from "proper" factors. – J.G. Dec 14 '18 at 23:37
  • Sorry but the probability is $1/2$ is not an acceptable answer because the integers form an infinite set and there is no uniform probability on an infinite set. With your argument, you could also say that the probability for a number being prime is $1/2$... – Tom-Tom Dec 22 '18 at 20:53
  • 1
    The OP specifies that the "probabilty" would be a limit, and I'm using the word in this sense, as everybody seems to have understood. – ajotatxe Dec 23 '18 at 09:44
37

What kind of numbers have this property?

  • All multiples of 6 (because 6 = 2 × 3). So that's 1/6 of the integers.
  • All multiples of 12 (12 = 3 × 4), but these have already been counted as multiples of 6.
  • All multiples of 20 (20 = 4 × 5), so add 1/20 of the integers. But we've double-counted multiples of 60 (LCD of 6 and 20), so subtract 1/60. This gives us 1/6 + 1/20 - 1/60 = 1/5.
  • All multiples of 30 (5 × 6) or 42 (6 × 7), but again, these have already been counted as multiples of 6.
  • All multiples of 56 (7 × 8), but don't double-count the ones that are also multiples of 6 or 20. If I did the arithmetic correctly, this brings us up to 22/105.
  • All multiples of 72 (8 × 9) or 90 (9 × 10), but these are already multiples of 6.
  • All multiples of 110 (10 × 11), being careful not to double-count multiples of 6, 20, or 56. We're now at 491/2310.

Continue the pattern to get a lower bound on the probability. I bet it converges to something, but I haven't bothered to compute what.

Dan
  • 18,262
  • 3
    Don't forget that 1/2 gives you the other bound, for the same reason as the original answer – Eric Dec 14 '18 at 08:24
  • 7
    True: The product of two consecutive integers is always even, so no odd number can have the property we're looking for. – Dan Dec 14 '18 at 13:29
  • 4
    Continuing until 190×191, you get a density of approximately 0.2215. It gets exponentially harder to calculate as you go along, and doesn't converge amazingly fast. (Exact fraction $30692078612850182537626772507400566302461540183482511947993/138565669082349191587117161961128738469412352721071780196786$). – Veedrac Dec 14 '18 at 18:00
  • 1
    Maybe it converges to $e^{-3/2} ≈ 0.22313$. I don't know how to prove that, though. – Dan Dec 14 '18 at 18:02
  • 2
    @Dan I doubt it. The 0.22194814 I measured manually has fairly low error (I'd guess 4-5 s.f.). Using an approximate version of this post (ignoring terms $<10^{-11}$) I also get 0.221941 at 10882×10883, which is definitely imprecise but lends credence to that ballpark. – Veedrac Dec 14 '18 at 18:12
  • 2
    Using a Sieve of Eratosthenes-style algorithm with size up to 10^9, I estimated the proportion to be 0.221947862. MATLAB code. – user12205 Dec 14 '18 at 21:59
  • 5
    We can also compute upper bounds using $\sum_{n=k}^\infty \frac{1}{n(n+1)} = \frac{1}{k}$. Let $s_k$ be the lower bound computed using the terms up to $k \times (k+1)$. Then, an upper bound is $s_k + 1/(k+1)$. For instance, if we apply this to Veedrac's estimate for $10882 \times 10883$, we get an approximate upper bound of $0.221941 + 1/10883$, which is about $0.222033$. – Eric M. Schmidt Dec 15 '18 at 23:08
  • @EricM.Schmidt How did you get the upper bound as that formula? – Nico A Dec 16 '18 at 02:09
  • 1
    @TreFox For instance, we get an upper bound of $1/2$ by summing $1/(n(n+1))$ over all $n \ge 2$. It is only an upper bound because we haven't taken into account double counting. In my upper bound, $s_k$ is (by definition) the density of positive integers which are multiples of $n(n+1)$ for some integer $n$ with $2 \le n \le k$. The sum $\sum_{n=k+1}^\infty \frac{1}{n(n+1)} = \frac{1}{k+1}$ is an upper bound for the density of positive integers that are multiples of $n(n+1)$ for some $n > k$. – Eric M. Schmidt Dec 16 '18 at 04:48
  • 1
    @TreFox If it was the the infinite sum you were wondering about, it can by computed by writing $\frac{1}{n(n+1)} = \frac{1}{n} - \frac{1}{n+1}$, resulting in a telescoping series. – Eric M. Schmidt Dec 16 '18 at 04:49
  • @ace: Here is what the Inverse Symbolic Calculator says are expressions around your value: 2219478243621624 = (0315) -2+8x+5x^2-9x^4-8x^8 2219478363320571 = (0001) (GAM(2/3)+3^(1/3))/2^(1/3) 2219478547894674 = (0259) F(5/12,1/12;7/10,1/8,3/7;1) 2219478597410999 = (0011) sum((17/6n^3-17/2n^2+53/3n-2)/(n!+2),n=1..inf) 2219478629550927 = (0323) 1/24+1/249^(2/3) 2219478756865566 = (0323) 17+2^(1/3)17^(1/2) 2219479017490569 = (0191) Prod(1+(n^3+4n^2+5n)/C(2n,n),n=1..inf) 2219479086515096 = (0012) sum((1/3n^3+10n^2-73/3n+36)/C(2n,n),n=1..inf) – marty cohen Dec 17 '18 at 18:35