A085080 Smallest k such that n, k and n+k have the same prime signature (canonical form), or 0 if no such number exists.
0, 3, 2, 0, 2, 15, 0, 0, 0, 55, 2, 63, 0, 21, 6, 0, 2, 45, 0, 637, 14, 33, 0, 351, 0, 39, 0, 147, 2, 165, 0, 0, 6, 21, 22, 0, 0, 39, 26, 20237, 2, 231, 0, 325, 18, 39, 0, 4136875, 0, 18, 6, 423, 0, 135, 10, 1375, 34, 33, 2, 90, 0, 15, 12, 0, 21, 165, 0, 207, 22, 385, 2
Offset: 1
Keywords
Examples
a(12) = 63 as 12 + 63 = 75, 2^2*3 + 3^2*7 = 5^2*3, all have the prime signature p^2*q. a(1) = 0, because the only possible value for k is then 1, giving n+k=2, with a different signature. a(2) = 3, because 2, 3 and 2+3=5 have the same prime signature. a(36) = 0, because if a(n) exists then k exists such that k^2 + 36 = m^2 where k^2, 36 and m^2 have the same prime signature. Rewriting 36 = m^2 - k^2 = (m - k)*(m + k) and then inspection over divisors of 36 gives no terms. Alternatively checking Pythagorean triples gives the same result. - _David A. Corneth_, Mar 08 2019
Programs
-
Mathematica
a[n_?PrimeQ] := If[PrimeQ[n + 2], 2, 0]; a[2] = 3; a[36] = 0; ps[n_] := Sort[ FactorInteger[n][[;; , 2]] ]; a[n_] := Module[{k = 2, f = FactorInteger[n]}, ps0 = Sort[f[[;; , 2]]]; If[Length[f] == 1, 0, While[ps[k] != ps0 || ps[n + k] != ps0, k++]; k]]; Array[a, 71] (* Amiram Eldar, Mar 07 2019 works for n <= 71 *)
-
PARI
sigt(n) = vecsort(factor(n)[,2]~); a(n) = { if ((n==1) || (isprimepower(n) && !isprime(n)), return(0)); if (isprimepower(n) && !isprime(n), return(0)); if ((n!=2) && isprime(n), if (isprime(n+2), return(2), return(0))); if (n==36, return(0)); my(k=2, v = sigt(n)); while ((sigt(k) != v) || (sigt(n+k) != v), k++); k; } \\ Michel Marcus, Mar 07 2019; works for n <= 71
Extensions
a(20)-a(47) from Max Alekseyev, Aug 12 2013
a(48)-a(71) from Amiram Eldar, Mar 05 2019
Comments