OFFSET
1,3
COMMENTS
Subtract one (in primorial base representation A049345) from the least significant nonzero digit of n, then convert back to decimal.
LINKS
FORMULA
MATHEMATICA
Table[If[n == 1, 0, n - Times @@ Prime@ Flatten@ Position[TakeWhile[#, # > 0 &], 1] &@ Function[f, ReplacePart[Table[0, {PrimePi[f[[-1, 1]]]}], #] &@ Map[PrimePi@ First@ # -> 1 &, f]]@ FactorInteger@ n], {n, 93}] (* or *)
Table[n - If[OddQ@ n, 1, Function[p, Product[Prime@ k, {k, #[[p]]}]][LengthWhile[Differences@ #, # == 1 &] + 1] &@ PrimePi[FactorInteger[n][[All, 1]]]], {n, 93}] (* Michael De Vlieger, Aug 26 2016 *)
PROG
(Python)
from sympy import nextprime, primepi, primorial
def a002110(n): return 1 if n<1 else primorial(n)
def a053669(n):
p = 2
while True:
if n%p!=0: return p
else: p=nextprime(p)
def a276084(n): return primepi(a053669(n)) - 1
def a(n): return n - a002110(a276084(n))
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 23 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 23 2016
STATUS
approved