A061853 Difference between smallest prime not dividing n and smallest nondivisor of n.
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0
Offset: 1
Keywords
Examples
a(29)=2-2=0; a(30)=7-4=3; a(420)=11-8=3.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..30030
Programs
-
PARI
a(n) = {my(f = factor(n), d = divisors(f), res, p = 2, i = 1, j); while(i<=#f~ && f[i, 1]==p, i++; p = nextprime(p+1)); res = p; for(j=2, #d, if(d[j]!=j, return(res - d[j-1] - 1)))} \\ David A. Corneth, Jul 29 2017
-
Python
from sympy import nextprime def a053669(n): p=2 while n%p==0: p=nextprime(p) return p def a007978(n): p=2 while n%p==0: p+=1 return p def a(n): return a053669(n) - a007978(n) print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jul 29 2017
Extensions
Description corrected by Michael De Vlieger, Jul 28 2017
Comments