OFFSET
1,3
COMMENTS
First differs from A348001 at n = 27.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
MATHEMATICA
f[p_, e_] := p^(2^(-1 + Position[Reverse@ IntegerDigits[e, 2], 1]));
iphi[1] = 1; iphi[n_] := Times @@ (Flatten@ (f @@@ FactorInteger[n]) - 1);
idivs[n_] := Sort@ Flatten@ Outer[Times, Sequence @@ (FactorInteger[n] /. {p_, m_Integer} :> p^Select[Range[0, m], BitOr[m, #] == m &])]; idivs[1] = {1};
a[n_] := Length @ Union[iphi /@ idivs[n]]; Array[a, 100]
PROG
(PARI) iphi(n) = {my(f=factor(n), b); prod(i=1, #f~, b = binary(f[i, 2]); prod(k=1, #b, if(b[k], f[i, 1]^(2^(#b-k)) - 1, 1)))}
isidiv(d, f) = {if (d==1, return (1)); for (k=1, #f~, bne = binary(f[k, 2]); bde = binary(valuation(d, f[k, 1])); if (#bde < #bne, bde = concat(vector(#bne-#bde), bde)); for (j=1, #bne, if (! bne[j] && bde[j], return (0)); ); ); return (1); }
idivs(n) = {my(d = divisors(n), f = factor(n), idiv = []); for (k=1, #d, if(isidiv(d[k], f), idiv = concat(idiv, d[k])); ); idiv; } \\ Michel Marcus at A077609
a(n) = {my(d = idivs(n)); #Set(apply(x->iphi(x), d)); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Amiram Eldar, Mar 30 2023
STATUS
approved