• 84

## Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

## Goal

You have to calculate the derived number of a given positive integer, following these rules:
If a number is prime p, p′=1.
If a number is the product n×m, (n×m)′=n′×m+n×m′.
Yes, it follows almost all the traditional rules of the derivation, including 1′=0 and (p^n)′=n×p^(n−1) if p is prime; but not (p+q)′=p′+q′ for all p and q.
Input
A number n.
Output
the derivation of n
Constraints
1<n⩽10000
Example
Input
7
Output
1

A higher resolution is required to access the IDE

Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
Online Participants