OFFSET
2,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 2..20000
FORMULA
a(prime(k)^r) = prime(k+1)^r- prime(k)^r.
a(2^m*prime(k)) = 2^m*(prime(k+1) - prime(k)).
a(n) = A081761(n) - n. - Michel Marcus, Nov 02 2020
EXAMPLE
a(28) = 17 as 28 = 2^2*7 and 28+17 = 45 = 3^2*5, both have the prime signature p^2*q where p and q are primes.
MAPLE
s:= n-> sort(map(i-> i[2], ifactors(n)[2])):
a:= proc(n) option remember; local k;
for k while s(n)<>s(n+k) do od; k
end:
seq(a(n), n=2..100); # Alois P. Heinz, Feb 28 2018
MATHEMATICA
s[n_] := Sort[FactorInteger[n][[All, 2]]];
a[n_] := Module[{sn = s[n], k}, For[k = 1, True, k++, If[sn == s[n+k], Return[k]]]];
a /@ Range[2, 100] (* Jean-François Alcover, Nov 02 2020 *)
PROG
(PARI) a(n) = {my(k=1, s = vecsort(factor(n)[, 2]~)); while (vecsort(factor(n+k)[, 2]~) != s, k++); k; } \\ Michel Marcus, Nov 02 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jul 01 2003
EXTENSIONS
More terms from David Wasserman, Jan 12 2005
STATUS
approved