cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A340740 a(n) is the sum of all the remainders when n is divided by positive integers less than n/2 and coprime to n.

This page as a plain text file.
%I A340740 #18 Mar 18 2021 15:44:07
%S A340740 0,0,0,0,1,0,2,2,2,1,7,2,7,6,5,4,15,7,19,10,9,8,32,9,20,20,28,13,46,
%T A340740 14,47,31,27,31,48,17,62,39,58,26,87,26,94,53,52,41,127,48,100,65,79,
%U A340740 61,154,52,105,62,90,80,200,45,180,113,138,103,162,77,229,116,149,73,274,87,257,166,178
%N A340740 a(n) is the sum of all the remainders when n is divided by positive integers less than n/2 and coprime to n.
%H A340740 Robert Israel, <a href="/A340740/b340740.txt">Table of n, a(n) for n = 1..10000</a>
%F A340740 a(n) = Sum_{k=1..floor((n-1)/2)} (n mod k) * floor(1/gcd(n,k)). - _Wesley Ivan Hurt_, Jan 18 2021
%e A340740 For n = 11, a(11) = (11 mod 1)+(11 mod 2)+(11 mod 3)+(11 mod 4)+(11 mod 5) = 7.
%p A340740 f:= proc(n) local k;
%p A340740   add(`if`(igcd(k,n)=1, n mod k, 0),k=1..floor(n/2))
%p A340740 end proc:
%p A340740 map(f, [$1..100]);
%t A340740 Table[Sum[Mod[n, i]*Floor[1/GCD[i, n]], {i, Floor[(n - 1)/2]}], {n,
%t A340740 100}] (* _Wesley Ivan Hurt_, Jan 18 2021 *)
%o A340740 (PARI) a(n) = sum(k=1, n\2, if (gcd(k, n)==1, n%k)); \\ _Michel Marcus_, Jan 18 2021
%o A340740 (Python)
%o A340740 from math import gcd
%o A340740 def A340740(n): return sum(n % k for k in range(1,n//2+1) if gcd(k,n) == 1) # _Chai Wah Wu_, Mar 18 2021
%Y A340740 Cf. A067439.
%K A340740 nonn,look
%O A340740 1,7
%A A340740 _J. M. Bergot_ and _Robert Israel_, Jan 18 2021