We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #1: Multiples of 3 and 5
Project Euler #1: Multiples of 3 and 5
Contest ends in
Sort by
recency
|
1358 Discussions
|
Please Login in order to post a comment
l=[] n = int(input()) for i in range(n): m = int(input()) l.append(m) for i in l: q=[] for m in range(1,i): if m%3==0 or m%5==0: q.append(m) print(sum(q))
Js solution with BigInt
public static long sum(int n){ n--; long sum=0;
} sum=(3*n3*(n3+1))/2 + (5*n5*(n5+1))/2 - (15 * n15*(n15+1))/2;
}