You are viewing a single comment's thread from:

RE: Brainsteem Compute #1 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]

in #mathematics7 years ago (edited)

I've coded mine in the programming language R. (Can't upload images in post)

Here is my code (and output):

> ## Rycharde's Challenge:
> 
> # Find the sum of all the multiples of 5 or 7 below 2000:
> 
> # Limiting number:
> 
> limit_number <- 2000
> 
> # Empty Vector:
> candidates <- c()
> 
> for (i in 1:(limit_number - 1)){
+   if (i %% 5 == 0 | i %% 7 == 0){
+     candidates <- c(candidates, i) # Append.
+   }
+ }
> 
> sum(candidates) # Print Total; 626430
[1] 626430
Sort:  

Many thanks!

Coin Marketplace

STEEM 0.20
TRX 0.16
JST 0.030
BTC 66297.29
ETH 2682.98
USDT 1.00
SBD 2.87