OFFSET
1,2
COMMENTS
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..2534
MATHEMATICA
f[n_] := Block[{d = Divisors[n]}, Plus @@ (MoebiusMu[n/d](2^DivisorSigma[0, d] - 1))]; PrimeExponents[n_] := Flatten[ Table[ # [[2]], {1}] & /@ FactorInteger[n]]; lpe = {}; ln = {1}; Do[pe = Sort[PrimeExponents[n]]; If[ Position[lpe, pe] == {}, AppendTo[lpe, pe]; AppendTo[ln, f[n]]], {n, 1000}]; ln (* Robert G. Wilson v, Aug 14 2004 *)
PROG
(Python)
from functools import lru_cache
from itertools import count
from sympy import prime, integer_log, primorial, mobius, divisor_count, divisors
from oeis_sequences.OEISsequences import bisection
def A097211(n):
if n == 1: return 1
@lru_cache(maxsize=None)
def g(x, m, j): return sum(g(x//(prime(m)**i), m-1, i) for i in range(j, integer_log(x, prime(m))[0]+1)) if m-1 else max(0, x.bit_length()-j)
def f(x):
c = n-1+x
for k in count(1):
if primorial(k)>x:
break
c -= g(x, k, 1)
return c
m = bisection(f, n, n)
return sum(mobius(m//d)<<divisor_count(d) for d in divisors(m, generator=True)) # Chai Wah Wu, Mar 24 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Matthew Vandermast, Aug 09 2004
EXTENSIONS
Second comment edited by Matthew Vandermast, Oct 21 2008
STATUS
approved
