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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A301630 a(n) = distance of n-th prime to nearest prime power p^k, k=0 and k >= 2 (A025475). 1
1, 1, 1, 1, 2, 3, 1, 3, 2, 2, 1, 5, 8, 6, 2, 4, 5, 3, 3, 7, 8, 2, 2, 8, 16, 20, 18, 14, 12, 8, 1, 3, 9, 11, 20, 18, 12, 6, 2, 4, 10, 12, 22, 24, 28, 30, 32, 20, 16, 14, 10, 4, 2, 5, 1, 7, 13, 15, 12, 8, 6, 4, 18, 22, 24, 26, 12, 6, 4, 6, 8, 2, 6, 12, 18, 22, 28, 36, 40, 48, 58, 60, 70, 72, 73, 69, 63, 55 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,5

LINKS

Altug Alkan, Table of n, a(n) for n = 1..10000

FORMULA

a(n) = A061670(A000040(n)).

EXAMPLE

a(9) = a(10) = 2 because 5^2 is the nearest prime power (A025475) to prime(9) = 23 and 3^3 is the nearest prime power (A025475) to prime(10) = 29.

MAPLE

Primes:= select(isprime, [2, seq(i, i=3..1000, 2)]):

Ppows:= sort([1, seq(seq(p^j, j=2..floor(log[p](1000))), p=Primes)]):

for n from 1 while Primes[n] < Ppows[-1] do

  i:= ListTools:-BinaryPlace(Ppows, Primes[n]);

  A[n]:= min(Primes[n]-Ppows[i], Ppows[i+1]-Primes[n])

od:

seq(A[i], i=1..n-1); # Robert Israel, Mar 26 2018

PROG

(PARI) isA025475(n) = {isprimepower(n) && !isprime(n) || n==1}

a(n) = {my(k=1, p=prime(n)); while(!isA025475(p+k) && !isA025475(p-k), k++); k; }

CROSSREFS

Cf. A047972, A047973, A061670.

There are four different sequences which may legitimately be called "prime powers": A000961 (p^k, k >= 0), A246655 (p^k, k >= 1), A246547 (p^k, k >= 2), A025475 (p^k, k=0 and k >= 2).

Sequence in context: A007413 A277750 A072457 * A063047 A003270 A099054

Adjacent sequences:  A301627 A301628 A301629 * A301631 A301632 A301633

KEYWORD

nonn,look

AUTHOR

Altug Alkan, Mar 24 2018

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 14 11:04 EST 2018. Contains 317182 sequences. (Running on oeis4.)