OFFSET
1,3
COMMENTS
Terms are only 0, 1 or 2.
FORMULA
EXAMPLE
For n = 8 the 8th highly composite numbers is 48, thus its nearest neighbors are 47 and 49, only 47 is prime so a(8) = 1.
For n = 9 the 9th highly composite numbers is 60, thus its nearest neighbors are 59 and 61, both are twin primes so a(9) = 2.
For n = 10 the 10th highly composite numbers is 120, thus its nearest neighbors are 119 and 121, both are nonprimes so a(10) = 0.
MATHEMATICA
f[n_] := Count[n + {-1, 1}, _?PrimeQ]; s = {}; dm = 0; Do[d = DivisorSigma[0, n]; If[d > dm, dm = d; AppendTo[s, f[n]]], {n, 1, 10^6}]; s (* Amiram Eldar, Aug 17 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Omar E. Pol, Aug 17 2021
EXTENSIONS
More terms from Amiram Eldar, Aug 17 2021
STATUS
approved