yaworsw/euler-manager

View on GitHub
data/problems/254.yml

Summary

Maintainability
Test Coverage
---
:id: 254
:name: Sums of Digit Factorials
:url: https://projecteuler.net/problem=254
:content: |+
  Define f(<var>n</var>) as the sum of the factorials of the digits of <var>n</var>. For example, f(342) = 3! + 4! + 2! = 32.

  Define sf(<var>n</var>) as the sum of the digits of f(<var>n</var>). So sf(342) = 3 + 2 = 5.

  Define g(<var>i</var>) to be the smallest positive integer <var>n</var> such that sf(<var>n</var>) = <var>i</var>. Though sf(342) is 5, sf(25) is also 5, and it can be verified that g(5) is 25.

  Define sg(<var>i</var>) as the sum of the digits of g(<var>i</var>). So sg(5) = 2 + 5 = 7.

  Further, it can be verified that g(20) is 267 and ∑ sg(<var>i</var>) for 1 ≤ <var>i</var> ≤ 20 is 156.

  What is ∑ sg(<var>i</var>) for 1 ≤ <var>i</var> ≤ 150?