OFFSET
1,2
COMMENTS
a(n) is divisible by A026741(n). - Robert Israel, Oct 01 2017
The number of these integers is A116512(n), for n >= 2. - Amiram Eldar, Nov 20 2025
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
From Amiram Eldar, Nov 20 2025: (Start)
a(n) = (n + f(n)) * A116512(n) / 2, where f(n) = p if n = p^k is a prime power (where p is prime) and f(n) = 0 otherwise, for n >= 2.
Dirichlet g.f.: 1 + (zeta(s-2)/zeta(s-1) + 1) * A(s-1) / 2, where A(s) = Sum_{n>=1} A069513(n)/n^s = Sum_{p prime} 1/(p^s-1).
EXAMPLE
12 is divisible by 2 and 3. The positive integers which are <= 12 and which are divisible by 2 or 3 but not by both 2 and 3 are: 2, 3, 4, 8, 9, 10. a(12) = the sum of these integers, which is 36.
MAPLE
f:= proc(n) local P;
P:= convert(numtheory:-factorset(n), list);
convert(select(k -> nops(select(p->k mod p = 0, P))=1, [$2..n]), `+`)
end proc:
1, seq(f(n), n=2..100); # Robert Israel, Oct 01 2017
MATHEMATICA
Table[Total@ Select[Range@ n, Function[k, Total@ Boole@ Map[Divisible[k, #] &, FactorInteger[n][[All, 1]]] == 1]], {n, 62}] (* Michael De Vlieger, Oct 01 2017 *)
a[n_] := Module[{f = FactorInteger[n], p}, p = f[[;; , 1]]; (n + If[Length[p] == 1, p[[1]], 0]) * n * Times @@ (1 - 1/p) * Total[1/(p - 1)] / 2]; a[1] = 1; Array[a, 100] (* Amiram Eldar, Nov 20 2025 *)
PROG
(PARI) a(n) = if(n == 1, 1 , my(f = factor(n), p = f[, 1]); (n + if(#p == 1, p[1], 0)) * n * prod(i = 1, #p, 1 - 1/p[i]) * sum(i = 1, #p, 1/(p[i] - 1)) / 2); \\ Amiram Eldar, Nov 20 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Leroy Quet, Jul 30 2006
EXTENSIONS
Corrected and extended by Joshua Zucker, Aug 12 2006
STATUS
approved
