cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A061602 Sum of factorials of the digits of n.

Original entry on oeis.org

1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 2, 2, 3, 7, 25, 121, 721, 5041, 40321, 362881, 3, 3, 4, 8, 26, 122, 722, 5042, 40322, 362882, 7, 7, 8, 12, 30, 126, 726, 5046, 40326, 362886, 25, 25, 26, 30, 48, 144, 744, 5064, 40344, 362904, 121, 121, 122, 126
Offset: 0

Views

Author

Amarnath Murthy, May 19 2001

Keywords

Comments

Numbers n such that a(n) = n are known as factorions. It is known that there are exactly four of these [in base 10]: 1, 2, 145, 40585. - Amarnath Murthy
The sum of factorials of the digits is the same for 0, 1, 2 in any base. - Alonso del Arte, Oct 21 2012

Examples

			a(24) = (2!) + (4!) = 2 + 24 = 26.
a(153) = 127 because 1! + 5! + 3! = 1 + 120 + 6 = 127.
		

Crossrefs

Cf. A061603, A108911, A193163, A165451 (places of primes).

Programs

  • Magma
    a061602:=func< n | n eq 0 select 1 else &+[ Factorial(d): d in Intseq(n) ] >; [ a061602(n): n in [0..60] ]; // Klaus Brockhaus, Nov 23 2010
    
  • Maple
    A061602 := proc(n)
            add(factorial(d),d=convert(n,base,10)) ;
    end proc: # R. J. Mathar, Dec 18 2011
  • Mathematica
    a[n_] := Total[IntegerDigits[n]! ]; Table[a[n], {n, 1, 53}] (* Saif Hakim (saif7463(AT)gmail.com), Apr 23 2006 *)
  • PARI
    a(n) = { if(n==0, 1, my(d=digits(n)); sum(i=1, #d, d[i]!)) } \\ Harry J. Smith, Jul 25 2009
    
  • Python
    import math
    def A061602(n):
        s=0
        for i in str(n):
            s+=math.factorial(int(i))
        return s # Indranil Ghosh, Jan 11 2017
    
  • R
    i=0
    values <- c()
    while (i<1000) {
      values[i+1] <- A061602(i)
      i=i+1
    }
    plot(values)
    A061602 <- function(n) {
      sum=0;
      numberstring <- paste0(i)
      numberstring_split <- strsplit(numberstring, "")[[1]]
      for (number in numberstring_split) {
        sum = sum+factorial(as.numeric(number))
      }
      return(sum)
    }
    # Raphaƫl Deknop, Nov 08 2021

Extensions

Corrected and extended by Vladeta Jovovic, May 19 2001
Link and amended comment by Mark Hudson (mrmarkhudson(AT)hotmail.com), Nov 12 2004