login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = Sum_{k=1..n} (-1)^(k+1) * floor((n/k)^k).
4

%I #19 Dec 20 2021 12:22:03

%S 1,1,2,1,2,1,2,0,2,2,3,0,3,2,4,-1,2,1,1,0,3,2,2,-2,2,-1,2,2,2,-1,3,-1,

%T 7,2,2,0,3,2,4,-2,3,-1,1,1,0,3,5,-1,4,1,1,-2,1,1,5,-2,4,-1,4,0,3,1,1,

%U -1,2,1,3,-1,6,-1,2,-5,7,0,1,-1,4,-2,8,-5,2,4,1,3,2,4,2,-3,1,0,2,-1,3,4,0,-6,2,-1,6,3,3,1,5,-6,9

%N a(n) = Sum_{k=1..n} (-1)^(k+1) * floor((n/k)^k).

%H Seiichi Manyama, <a href="/A350223/b350223.txt">Table of n, a(n) for n = 1..5000</a>

%e a(3) = [3/1] - [(3/2)^2] + [(3/3)^3] = 3 - 2 + 1 = 2.

%e a(4) = [4/1] - [(4/2)^2] + [(4/3)^3] - [(4/4)^4] = 4 - 4 + 2 - 1 = 1.

%t a[n_] := Sum[(-1)^(k + 1)*Floor[(n/k)^k], {k, 1, n}]; Array[a, 100] (* _Amiram Eldar_, Dec 20 2021 *)

%o (PARI) a(n) = sum(k=1, n, (-1)^(k+1)*(n^k\k^k));

%Y Cf. A347415, A350224.

%K sign

%O 1,3

%A _Seiichi Manyama_, Dec 20 2021