login
Sum of the integers from 1 to n that are not antidivisors of n.
2

%I #9 Dec 03 2024 15:10:36

%S 1,3,4,7,10,17,18,28,37,41,54,65,72,89,102,122,125,143,172,186,209,

%T 217,242,277,286,327,336,360,411,429,454,470,513,565,578,634,653,671,

%U 728,765,820,837,890,950,949,1023,1068,1120,1153,1195,1284,1284,1343,1433

%N Sum of the integers from 1 to n that are not antidivisors of n.

%C First two equal consecutive values for a(51) = a(52) = 1284.

%F a(n) = A000217(n) - A066417(n).

%e a(30) = 429 because 30*31/2 = 465, the antidivisors of 30 are 4, 12, 20 and 465 - 4 - 12 - 20 = 429.

%p with(numtheory): P:=proc(q) local j,k,n,v; v:=[1];

%p for n from 2 to q do k:=0; j:=n; while j mod 2<>1 do k:=k+1; j:=j/2; od;

%p v:=[op(v),n*(n+1)/2-(sigma(2*n+1)+sigma(2*n-1)+sigma(n/2^k)*2^(k+1)-6*n-2)];

%p od; op(v); end: P(10^2);

%o (Python)

%o from sympy import divisor_sigma

%o def A378414(n): return 1 if n == 1 else (n*(n+13)>>1)+2-divisor_sigma((m:=n<<1)-1)-divisor_sigma(m+1)-(divisor_sigma(n>>(k:=(~n&n-1).bit_length()))<<k+1) # _Chai Wah Wu_, Dec 03 2024

%Y Cf. A000217, A024816, A066417.

%K nonn,easy

%O 1,2

%A _Paolo P. Lava_, Nov 25 2024