The prime 127 has 127-1=126 with distinct prime factors 2,3,7 and 127+1=128 with distinct prime factors of only 2; hence 2*3*7=42<127. Log 127/42=q=1.296. Are such primes common? Can a value of q be larger for other primes? I tried before but was not logged in. More examples are 31, with distinct prime factors of 30=2*3*5 and for 32 just 2; hence 2*3*5<31. For 97, 96 has prime factors 2 and 3 and 98 has prime factors 2 and 7; hence 2*3*7=42<97.

[EDIT suggestion to OP: I think the question is asking this: given a prime $p$, calculate the squarefree kernel, $s$, of $p^2-1$ (that is, the product of the distinct prime factors of $p^2-1$); is it common to have $s<p$? is it possible to have $p/s>127/42$? By "common", we may understand "does it happen infinitely often?"] Gerry Myerson understood the question. I can't see why it was closed. Could it be that no one is curious enough to write a program to find more such primes?

  • $\begingroup$ What does "such" mean? $\endgroup$ Jun 24, 2016 at 18:25
  • 2
    $\begingroup$ I think the question is clear. Given a prime $p$, calculate the squarefree kernel of $p^2-1$ (that is, the product of the distinct prime divisors of $p^2-1$), call it $s$, is it common to have $s<p$? Is it possible to have $p/s>127/42$? $\endgroup$ Jun 25, 2016 at 0:49
  • 1
    $\begingroup$ Let $p=577$, then $p-1=576=2^63^2$ and $p+1=578=2\cdot17^2$, so $s=2\cdot3\cdot17=102$, and $p/s=577/102>127/42$. $\endgroup$ Jun 30, 2016 at 3:12
  • 1
    $\begingroup$ For $p < 20000000$, the largest value for $q$ is achieved for $p = 4801$, where $s = 210$ and $q \approx 1.58526$. $\endgroup$
    – Stefan Kohl
    Jul 2, 2016 at 22:59
  • 1
    $\begingroup$ What about 2101249? Gerhard "Are There Too Many Zeroes?" Paseman, 2016.07.02. $\endgroup$ Jul 2, 2016 at 23:29

1 Answer 1


Here is a program written in AWK. You can probably optimize it by aborting the factorization when it is clear that the radical (prod) will be too large to continue. Otherwise you spend a lot of time trial factoring, and it goes slowly once LIM gets above 2000.

BEGIN{  LIM=2000;  LIM2=LIM*LIM;  maxn=maxprod=j=1
   for( n=1; (n++) < LIM2; )  {
      if (n in c) { m=n+(f=c[n]); delete c[n]
           while (m in c) {m+=f};  c[m]=f }
      else {  if (n < LIM) {pr[j++]=n; c[(n+n)]=n }; check(n) }

function check(n) { m=n-1 ; o=n+1; prod=1
    for( jj=1; (1<m)||(1<o) ; ) { f=pr[jj++]; add=0
        while (0==m%f) { add=1; m/=f }
        while (0==o%f) { add=1; o/=f }
        if (1==add) prod*=f
        if ((m > 1) && ((f*f) > m)) { prod*=m; m=1 }
        if ((o > 1) && ((f*f) > o)) { prod*=o; o=1 }
    if (n*maxprod > prod*maxn) {maxprod=prod; maxn=n;
        print n, prod, n/(1.0*prod) }

I get as output

3 2 1.5
17 6 2.83333
127 42 3.02381
577 102 5.65686
4801 210 22.8619
2101249 23370 89.9122

This strikes me as being related to consecutive smooth numbers m,m+1 such that 2m+1 is prime. You might look up Stormer's theorem on consecutive smooth numbers. I don't know how you will work in the prime bit.

Gerhard "Have Fun With AWK Programs" Paseman, 2016.07.02.

  • $\begingroup$ The code above may contain errors, as it was hand-entered. You might prefer the implementation at mathoverflow.net/a/50691 which produces prime factor lists. If you write up anything based on either program, I would appreciate attribution. Gerhard "Says Yes To Gift Cards" Paseman, 2016.07.02. $\endgroup$ Jul 3, 2016 at 0:16
  • $\begingroup$ Perhaps the right question to ask is whether $p/s$ is unbounded. $\endgroup$ Jul 3, 2016 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.