|
|
A074332
|
|
Direction from n-th perfect power to closest prime (-1 if down, 1 if up, 0 if two primes are closest).
|
|
0
|
|
|
-1, 0, 1, 0, -1, 1, -1, 1, -1, 1, 0, 0, -1, -1, -1, 1, 0, 1, -1, 1, 0, 1, -1, -1, 0, -1, 1, -1, 0, -1, 1, 1, -1, 0, -1, 1, -1, 1, -1, -1, 1, 1, 0, 1, 1, -1, 1, 1, -1, -1, -1, 0, 0, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 0, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 0, 1, -1, 1, 0, -1, -1, -1, 1, 1, -1, 1, 1, 0, -1, -1, 1, -1, 1, 1, 0, -1, 1, -1, 1, 1, 1, -1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
Sign(n-th perfect power - closest prime) or 0 if two primes are closest.
|
|
EXAMPLE
|
The 7th perfect power (A001597) is 27. The closest prime to 27 is 29. sign(27-29)=-1, so a(7)=-1. The 11th perfect power is 64. There is no single closest prime to 64, since two primes are closest, namely 61 and 67, so a(11)=0.
|
|
MATHEMATICA
|
NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; pp = Select[ Range[10000], !PrimeQ[ # ] && Apply[ GCD, Last[ Transpose[FactorInteger[ # ]]]] > 1 & ]; Join[{-1}, Sign[ Table[ NextPrim[pp[[n]]] - pp[[n]], {n, 1, 124}] - Table[ pp[[n]] - PrevPrim[pp[[n]]], {n, 1, 124}]]]
ppcp[n_]:=Module[{a=NextPrime[n, -1], b=NextPrime[n]}, Which[n-a==b-n, 0, n-a < b-n, 1, True, -1]]; ppcp/@Join[{1}, Select[Range[8000], GCD@@FactorInteger[#][[All, 2]]>1&]] (* Harvey P. Dale, Aug 28 2018 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|