A project that implements sequence A003415 from OEIS, the On-line Encyclopedia of Integer Sequences. The sequence in question is the arithmetic derivative of a number:
n' = arithmetic derivative of n: f(0) = f(1) = 0; f(prime) = 1; f(m * n) = (m * f(n)) + (n * f(m)). Can be extended to negative numbers by defining f(-n) = -f(n).
I implemented the arithmetic derivative with 2 major blocks:
(algorithm from here, 1000 primes from here)
... this algorithm I kind of made up myself and frankly don't really know how to explain. pf-1 stands for "prime factorization 1-step," and does one level of prime factorization. For example, while the prime factorization of 4755 is 3x5x317, pf-1 returns 15x317. It checks numbers from 1 to the ceiling value to see if they are a factor of n. If it doesn't return a valid factor (i.e. the block says that a number only has the factor of 1 when it isn't prime), the ceiling value is increased, and it is called again. Both the initial ceiling value and the value by which you increase the ceiling are arbitrary, but I think 20 and 10 are good so you don't have to run the algorithm too many times... which should save on time...
These blocks are used in the prime factorization block (which isn't used in the project)...
and the arithmetic derivative block, which was the main goal of the project:
Yeah!! There's no real point to it, just having fun. But I hope it is interesting!