login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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; internal format)
OFFSET

1,1

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}]]]

CROSSREFS

Cf. A001597.

Sequence in context: A094934 A054354 A156728 * A152065 A113428 A133101

Adjacent sequences:  A074329 A074330 A074331 * A074333 A074334 A074335

KEYWORD

sign

AUTHOR

N. Fernandez (primeness(AT)borve.org), Oct 12 2002

EXTENSIONS

Edited by Robert G. Wilson v (rgwv(AT)rgwv.com), Oct 13 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 15 17:13 EST 2012. Contains 205828 sequences.