Group Abstract Group Abstract

Message Boards Message Boards

Extending Matt Parker's List: 4 Primes p where tan(p) > p

Posted 5 months ago

Matt Parker has a nice video discussing the smallest prime p that satisfies Tan[p] > p, namely a user submitted 46 digit prime:

p == 1169809367327212570704813632106852886389036911

In the video he discusses why such primes are difficult to find and that no other such prime is known. It's worth a watch and can be seen here.

In this post we will find 3 new primes satisfying this inequality. These are large integers and are roughly

2.308358707825588 * 10^1016
4.094619989884699 * 10^35084
1.086855570320019 * 10^43176

We will assume an integer n being prime and satisfying Tan[n] > n are two independent conditions and both occurring simultaneously is effectively by chance. Therefore we can find a set of integers satisfying one condition and then filter with the other condition.

Now we know from the prime number theorem that for a given upper bound x there are about x/Log[x] primes.

Though sublinear, primes are much more frequent than the other condition Tan[n] > n. Consider the plot of Tan[x] and x, where the red regions represent the domain where such integers n can occur:

Plot[{Tan[x], x}, {x, 0, 9π}, 
  Filling -> {1 -> {2}}, FillingStyle -> {Opacity[0], Append[Red, 1]}, 
  PlotStyle -> Directive[Thin, Black], PlotRange -> {0, 9π}, AspectRatio -> 1/2]

To look for the width of the regions we consider Tan[n π + π/2 - ε] == n π + π/2 - ε, where here ε is the width of the nth red region:

AsymptoticSolve[
 Normal @ Series[Refine[Tan[n π + π/2 - ε], n ∈ Integers], {ε, 0, 1}]] == n π + π/2 - ε,
 ε -> 0, n -> ∞, Reals
]
 (* {{ε -> 1/(n π)}} *)

Thus, summing the ε's that intersect (0, x) we expect roughly Log[x]/π integers n to satisfy Tan[n] > n.

Therefore our strategy is to find integers n that satisfy Tan[n] > n and then to check if they're also prime.

Method 1 Convergents

Since ε is far less than 1, we can get a bit fuzzy and look for n such that Tan[n] ≈ n. This means we're looking for integers n such that n ≈ k π + π/2 for some integer k. Isolating π, we can see this means we are looking for a tight rational approximation for π of the form

π ≈ (2n)/(2k+1)

Now, it's well known that convergents provide the best rational approximations (in a quantifiable sense) -- and so a heuristic is to find the convergents of π with an even numerator, then check if half that numerator satisfies our inequality:

Block[{$MaxExtraPrecision = ∞},
  Length[cands = Select[Select[Numerator[Convergents[π, 100000]], EvenQ]/2, Tan[#] > # &]]
]
 (* 16778 *)

We see here that of the first 100,000 convergents of π, roughly one sixth of them yield integers satisfying our inequality. And to get a sense of magnitude, this covers integers ranging up to ~10^51000:

N[Last[cands]]
 (* 2.129263410447718 * 10^51420 *)

Lastly we filter for the primes:

ppQ = ParallelMap[
   Block[{$MaxExtraPrecision = ∞}, 
     If[PrimeQ[#], Print[N[#]]; True, False]] &, cands, 
   ProgressReporting -> True, Method -> "ItemsPerEvaluation" -> 10];

Position[ppQ, True]
 (* {{13}, {314}, {11440}} *)

primes = Pick[cands, ppQ];

N[primes]
(* {1.16981 * 10^45, 2.308358707825588 * 10^1016, 4.094619989884699 * 10^35084} *)

So we found the same prime in Matt Parker's video plus two more!

Method 2 Lattice Reduction

Did we exhaustively search for all the primes less than 10^51000 above? Well, no -- we just employed a (powerful) heuristic. In fact based on the largest convergent we found, the number candidates, and the asymptotic formula for integers that satisfy our inequality, method 1 found about half of the candidates to filter from in its search domain.

A big sledge hammer in integer relation algorithms (but still a heuristic here) is that of lattice reduction.

Lattice reduction takes in a basis of integer vectors and returns a new integer basis spanning the same space, where each vector has a 'small' Euclidean norm. A simple application to find nontrivial relationships can be seen in the ref page for LatticeReduce here.

Similar to section 4.2 of my paper Computations of the Mertens Function and Improved Bounds on the Mertens Conjecture which looks for multiple simultaneous approximations for π, we can use LatticeReduce as follows for a single approximation to π:

TancN[ν_, base_:10] :=
  Block[{X, A, B, k, n, pQ, $MaxExtraPrecision = ∞},
    X = base^ν;
    A = {
      {Floor[π/2*X], base^10*X, 0},
      {Floor[π*X],   0,         1},
      {-X,           0,         0}
    };

    B = LatticeReduce[A];

    k = MaximalBy[B, Max[Abs[#]]&][[1, -1]];
    n = Abs[Round[π*k + π/2]];

    pQ = Tan[n] > n && PrimeQ[n];
    If[pQ, Print[{ν, N[n]}]];

    n -> pQ
  ]

And after about 8.5 hours of computing:

data = ParallelMap[TancN, Range[100000], ProgressReporting -> True]; // AbsoluteTiming

Length[primes = Union[Cases[data, (p_ -> True) :> p]]]
 (* 4 *)

The primes we get are the three from before plus a new one:

N[primes]
 (* {1.16981 * 10^45, 2.308358707825588 * 10^1016, 
   4.094619989884699 * 10^35084, 1.086855570320019 * 10^43176} *)

The Data

The full integer data for these primes can be downloaded here:

obj = CloudObject["https://www.wolframcloud.com/obj/0dec6477-4d21-49a6-8c14-eb8618af9917"];

The data:

primes = CloudGet[obj];

N[primes]
 (* {1.16981 * 10^45, 2.308358707825588 * 10^1016, 
   4.094619989884699 * 10^35084, 1.086855570320019 * 10^43176} *)
POSTED BY: Greg Hurst
3 Replies

I am Jacob, the person who originally sent the question and the 46-digit lowest prime p for which tan(p)>p to Matt Parker. Matt mentions me in his video. I just saw your post now, and it is wonderful that you have published your method and results for the next three terms in the series of such numbers. In the discussions that followed Matt Parker's video, somebody did calculate all three of these three extra terms, but I do not know if this was you or someone else.

It is not clear to me whether these are all properly proven primes or probable primes; maybe you can clarify this.

I remember at the time I posed the original question that I estimated that each term could be expected to have about 30 times as many digits as the previous term, which is why the 46000-digit term was surprising, but maybe not statistically impossible.

I suppose there are two questions that might be of interest:
1) Can one prove that the sequence of primes for which tan(p)>p is infinite ? There is some discussion about this on OEIS (A249836)
2) Is there any significance to this sequence? Probably not, but one thought is this: The numerator and denominator of the convergent rational approximations to pi/2 are necessarily mutually prime. The numerators form terms of this sequence so they are primes by definition. Therefore, the statistical spreads of the primes, and the convergents to pi/2 are not fully independent, so it might not be true that the chance of a number being in this sequence can be calculated by multiplying the chance of finding a prime with the chance of finding an unusually good rational approximation to pi/2. It would be interesting to see an analysis of this; something of which I am not capable.

Another thing that it is tempting to ask is whether a 5th term could be found. Matt Parker quotes me in his video as saying that there is no chance of finding a second term, and it did not take long for me to be proven totally wrong about this.

Lastly, since you now have a sequence of 4 integers, it might be nice if you post the series on OEIS. It might be the fastest-growing series in all of OEIS. I do not know how welcoming OEIS would be of a 46000 digit number!

POSTED BY: Jacob Undeclared
Posted 9 days ago

Hi Jacob,

Thanks for the reply!

That was not me in the youtube comments. Though I just scanned through them and only saw 2.308358707825588 * 10^1016 mentioned through the continued fractions method.

I would wager these primes here are not proven. I attempted to run ProvablePrimeQ on these, but I never got an answer back in a reasonable amount of time. Of course there are probably better tools for this out there.

I would imagine that there are infinite number of these primes, but their occurrence gets rarer and rarer. Of course I base this off of asymptotics alone -- a good intuition builder, but not necessarily correct. I'd like to try to push this to a 5th prime if I ever get a chance, or rather if I get a change to leave my computer running for a week or two or so.

I contacted Matt Parker awhile back showing the next three terms in the series, but never heard back. I was hoping this post might reach him too. I think these two methods would make a nice video on his channel! Though seems he's off doing bigger things like working with elections, and moon landings these days...

POSTED BY: Greg Hurst

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard