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.

A303935 Size of orbit of n under repeated application of sum of factorial of digits of n.

This page as a plain text file.
%I A303935 #43 Feb 21 2020 20:57:27
%S A303935 2,1,1,16,8,10,15,32,36,35,2,2,17,33,13,10,15,32,36,35,17,17,9,37,7,
%T A303935 12,6,8,33,31,33,33,37,18,34,31,48,39,24,8,13,13,7,34,30,54,42,39,29,
%U A303935 52,10,10,12,31,54,10,24,21,41,24,15,15,6,48,42,24,12,42
%N A303935 Size of orbit of n under repeated application of sum of factorial of digits of n.
%C A303935 Numbers n for which a(n)=1 are called factorions (A014080).
%C A303935 Apart from factorions, only 3 cycles exist:
%C A303935 169 -> 363601 -> 1454 -> 169, so a(169) = a(363601) = a(1454) = 3.
%C A303935 871 -> 45361 -> 871, so a(871) = a(45361) = 2.
%C A303935 872 -> 45362 -> 872, so a(872) = a(45362) = 2.
%C A303935 All other n produce a chain reaching either a factorion or a cycle.
%H A303935 Philippe Guglielmetti, <a href="/A303935/b303935.txt">Table of n, a(n) for n = 0..1000</a>
%H A303935 S. S. Gupta, <a href="http://www.jstor.org/stable/3620841">Sum of the factorials of the digits of integers</a>, The Mathematical Gazette, 88-512 (2004), 258-261.
%H A303935 Project Euler, <a href="https://projecteuler.net/problem=74">Problem 74: Digit factorial chains</a>
%e A303935 For n = 4, 4!=24, 2!+4!=26, 2!+6!=722, 7!+2!+2!=5044, 5!+0!+4!+4!=169, 1!+6!+9!=363601, 3!+6!+3!+6!+0!+1!=1454, then 1!+4!+5!+4!=169 which already belongs to the chain, so a(4) = length of [4, 24, 26, 722, 5044, 169, 363601, 1454] = 8.
%t A303935 Array[Length@ NestWhileList[Total@ Factorial@ IntegerDigits@ # &, #, UnsameQ, All, 100, -1] &, 68, 0] (* _Michael De Vlieger_, May 10 2018 *)
%o A303935 (Python)
%o A303935 for n in count(0):
%o A303935     l=[]
%o A303935     i=n
%o A303935     while i not in l:
%o A303935         l.append(i)
%o A303935         i=sum(map(factorial,map(int,str(i))))
%o A303935     print(n,len(l))
%o A303935 (PARI) f(n) = if (!n, n=1); my(d=digits(n)); sum(k=1, #d~, d[k]!);
%o A303935 a(n) = {my(v = [n], vs = Set(v)); for (k=1, oo, new = f(n); if (vecsearch(vs, new), return (#vs)); v = concat(v, new); vs = Set(v); n = new;);} \\ _Michel Marcus_, May 18 2018
%Y A303935 Cf. A061602, A014080 (contains n for which a(n) = 1).
%K A303935 nonn,base
%O A303935 0,1
%A A303935 _Philippe Guglielmetti_, May 03 2018