OFFSET
1,5
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
PROG
(PARI)
up_to = 65537;
DirInverseCorrect(v) = { my(u=vector(#v)); u[1] = (1/v[1]); for(n=2, #v, u[n] = (-u[1]*sumdiv(n, d, if(d<n, v[n/d]*u[d], 0)))); (u) }; \\ Compute the Dirichlet inverse of the sequence given in input vector v.
A003602(n) = (1+(n>>valuation(n, 2)))/2;
v353366 = DirInverseCorrect(vector(up_to, n, A110963(n)));
A353366(n) = v353366[n];
(Python)
from functools import lru_cache
from sympy import divisors
@lru_cache(maxsize=None)
def A353366(n): return 1 if n==1 else -sum(((1+(m:=d>>(~d&d-1).bit_length())>>(m+1&-m-1).bit_length())+1)*A353366(n//d) for d in divisors(n, generator=True) if d>1) # Chai Wah Wu, Jan 04 2024
CROSSREFS
KEYWORD
sign
AUTHOR
Antti Karttunen, Apr 18 2022
STATUS
approved