OFFSET
1,4
COMMENTS
a(n)=0 iff sp(n) is a square of prime, sp(n) = n-th semiprime = A001358(n).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000 (first 1000 terms from Zak Seidov)
EXAMPLE
a(1)=0 because sp(1)=4=2*2 and 2-2=0; a(2)=1 because sp(2)=6=2*3 and 3-2=1; sp(n)=n-th semiprime.
MAPLE
with(numtheory): a:=proc(n) if bigomega(n)=2 and nops(factorset(n))=2 then factorset(n)[2]-factorset(n)[1] elif bigomega(n)=2 then 0 else fi end: seq(a(n), n=1..225); # Emeric Deutsch
# second Maple program:
b:= proc(n) option remember; local k;
if n=1 then 4
else for k from 1+b(n-1) do if not isprime(k) and
numtheory[bigomega](k)=2 then return k fi
od
fi
end:
a:= n-> (s-> max(s)-min(s))(numtheory[factorset](b(n))):
seq(a(n), n=1..100); # Alois P. Heinz, Feb 05 2017
MATHEMATICA
spQ[n_] := PrimeOmega[n] == 2; fi[n_] := FactorInteger[n];
f[n_] := fi[n][[-1, 1]] - fi[n][[1, 1]];
f[#] & /@ Select[Range@215, spQ] (* Zak Seidov, Oct 16 2014 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Jun 27 2005
EXTENSIONS
Edited by Zak Seidov, Oct 16 2014
STATUS
approved