OFFSET
1,2
COMMENTS
Previous name: Row sums of A127704.
From Robert Israel, Dec 29 2016: (Start)
a(n) = n if and only if n is in A008578.
a(p^j) = p^j - p^(j-1) if p is prime and j >= 2.
a(Product_{i=1..k} p_i) = Product_{i=1..k} (p_i-1) - (-1)^k if p_1, ..., p_k are distinct primes. (End)
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = mu(n) + Sum_{k|n,k>1} (k+1)*mu(n/k), where mu = A008683. - Robert Israel, Dec 29 2016
MAPLE
N := 100: # to get a(1)..a(N)
A:= Vector(N, numtheory:-mobius):
for k from 2 to N do
for j from 1 to floor(N/k) do
A[j*k]:= A[j*k] + (k+1)*numtheory:-mobius(j)
od od:
convert(A, list); # Robert Israel, Dec 29 2016
PROG
(Python)
def A127705_list(n):
upto = n + 1
p = [i for i in range(upto)]
for i in range(2, upto):
for j in range(i + i, upto , i):
p[j] -= p[i]
return p[1::]
print(A127705_list(1000)) # Peter Luschny, Sep 02 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Gary W. Adamson, Jan 24 2007
EXTENSIONS
Terms a(11) and beyond from Robert Israel, Dec 29 2016
New name using a formula of Robert Israel by Peter Luschny, Sep 02 2023
STATUS
approved