login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 5
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, 14, 47, 31, 27, 31, 48, 17, 62, 39, 58, 26, 87, 26, 94, 53, 52, 41, 127, 48, 100, 65, 79, 61, 154, 52, 105, 62, 90, 80, 200, 45, 180, 113, 138, 103, 162, 77, 229, 116, 149, 73, 274, 87, 257, 166, 178 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,7
LINKS
FORMULA
a(n) = Sum_{k=1..floor((n-1)/2)} (n mod k) * floor(1/gcd(n,k)). - Wesley Ivan Hurt, Jan 18 2021
EXAMPLE
For n = 11, a(11) = (11 mod 1)+(11 mod 2)+(11 mod 3)+(11 mod 4)+(11 mod 5) = 7.
MAPLE
f:= proc(n) local k;
add(`if`(igcd(k, n)=1, n mod k, 0), k=1..floor(n/2))
end proc:
map(f, [$1..100]);
MATHEMATICA
Table[Sum[Mod[n, i]*Floor[1/GCD[i, n]], {i, Floor[(n - 1)/2]}], {n,
100}] (* Wesley Ivan Hurt, Jan 18 2021 *)
PROG
(PARI) a(n) = sum(k=1, n\2, if (gcd(k, n)==1, n%k)); \\ Michel Marcus, Jan 18 2021
(Python)
from math import gcd
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
CROSSREFS
Cf. A067439.
Sequence in context: A352736 A086612 A128207 * A306707 A180958 A295854
KEYWORD
nonn,look
AUTHOR
J. M. Bergot and Robert Israel, Jan 18 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)