Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
def d(f g:_->int)(n):=(list.range$n+1iota n).foldr(λd s,ite(n%d=0)(s+f d*g(n/d))s)0
Try it online!Try it online!
More testcases with all of the functions.More testcases with all of the functions.
def d(f g:_->int)(n):=(list.range$n+1).foldr(λd s,ite(n%d=0)(s+f d*g(n/d))s)0
Try it online!
More testcases with all of the functions.
def d(f g:_->int)(n):=(list.iota n).foldr(λd s,ite(n%d=0)(s+f d*g(n/d))s)0
import data.list def d(f g:_->int)(n):=((list.range$n+1).mapfoldr(λd s,condite(n%d=0)(fs+f d*g(n/d))0)s).sum0
import data.list def d(f g:_->int)(n):=((list.range$n+1).map(λd,cond(n%d=0)(f d*g(n/d))0)).sum
import data.list.basic def d(f g:_->int)(n):=((list.range$n+1).map(fun dλd,if n%d=0then cond(n%d=0)(f d*g(n/d)else )0)).sum
import data.list.basic def d(f g:_->int)(n):=((list.range$n+1).map(fun d,if n%d=0then f d*g(n/d)else 0)).sum