sum of digits core function added