login
A194577
a(1)=1 and for n>=2 Sum_{k=1..n} a(k)*(-1)^floor(n/k)=0.
2
1, 1, -2, 4, -2, -4, -2, 12, 2, -4, -2, -16, -2, -4, 6, 36, -2, 8, -2, -16, 6, -4, -2, -56, 2, -4, -2, -16, -2, 20, -2, 108, 6, -4, 6, 36, -2, -4, 6, -56, -2, 20, -2, -16, -10, -4, -2, -192, 2, 8, 6, -16, -2, -12, 6, -56, 6, -4, -2, 88, -2, -4, -10, 324, 6
OFFSET
1,3
COMMENTS
This sequence has properties related to primes (see ref and link). For instance a(n)=-4 iff n=2p, p odd prime, a(n) = 2 iff n=p^(2k) and a(n) = -2 iff n=p^(2k-1) for k>=1 where p is an odd prime etc. Moreover the sequence A(n)=a(1)+a(2)+...+a(n)=A195133(n) presents fractal aspects (see the scatterplot of A195133(n) for 2^k<n<2^(k+1) and various k).
LINKS
C. Cattani, Fractal patterns in prime numbers distribution, Lecture Notes in Computer Science, 2010, Volume 6017/2010.
FORMULA
A special case is a(2^k) = 4*3^(k-2) for k>=2 (for the complete formula involving divisors see pari-code).
MAPLE
a:= proc(n) option remember;
`if`(n=1, 1, add(a(k)*(-1)^floor(n/k), k=1..n-1))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Sep 02 2011
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Sum[a[k]*(-1)^Floor[n/k], {k, 1, n-1}]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jun 12 2015 *)
PROG
(PARI) a(n)=if(n<3, 1, if(n%2, -2*sumdiv(n, d, if(n-d, a(d), 0)), 2*sumdiv(n/2, d, a(d))-2*sumdiv(n/2^valuation(n, 2), d, if(n/2^valuation(n, 2)-d, a(2^valuation(n, 2)*d), 0))))
CROSSREFS
Cf. A195133 (partial sums).
Sequence in context: A366261 A375200 A086152 * A334970 A274708 A280638
KEYWORD
sign
AUTHOR
Benoit Cloitre, Aug 30 2011
STATUS
approved