A007954 Product of decimal digits of n.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0
Links
- N. J. A. Sloane, Table of n, a(n) for n = 0..10000
- Rigoberto Flórez, Robinson A. Higuita and Antara Mukherjee, Alternating Sums in the Hosoya Polynomial Triangle, Article 14.9.5 Journal of Integer Sequences, Vol. 17 (2014).
- Florentin Smarandache, Only Problems, Not Solutions!.
- Index entries for Colombian or self numbers and related sequences
Crossrefs
Programs
-
Haskell
a007954 n | n < 10 = n | otherwise = m * a007954 n' where (n', m) = divMod n 10 -- Reinhard Zumkeller, Oct 26 2012, Mar 14 2011
-
Magma
[0] cat [&*Intseq(n): n in [1..110]]; // Vincenzo Librandi, Jan 03 2020
-
Maple
A007954 := proc(n::integer) if n = 0 then 0; else mul( d,d=convert(n,base,10)) ; end if; end proc: # R. J. Mathar, Oct 02 2019
-
Mathematica
Array[Times @@ IntegerDigits@ # &, 108, 0] (* Robert G. Wilson v, Mar 15 2011 *)
-
PARI
A007954(n)= { local(resul = n % 10); n \= 10; while( n > 0, resul *= n %10; n \= 10; ); return(resul); } \\ R. J. Mathar, May 23 2006, edited by M. F. Hasler, Apr 23 2015
-
PARI
A007954(n)=prod(i=1,#n=Vecsmall(Str(n)),n[i]-48) \\ (...eval(Vec(...)),n[i]) is about 50% slower; (...digits(n)...) about 6% slower. \\ M. F. Hasler, Dec 06 2009
-
PARI
a(n)=if(n,factorback(digits(n)),0) \\ Charles R Greathouse IV, Apr 14 2020
-
Python
from math import prod def a(n): return prod(map(int, str(n))) print([a(n) for n in range(108)]) # Michael S. Branicky, Jan 16 2022
-
Scala
(0 to 99).map(.toString.toCharArray.map( - 48).scanRight(1)( * ).head) // Alonso del Arte, Apr 14 2020
Formula
a(n) = abs(A187844(n)). - Reinhard Zumkeller, Mar 14 2011
a(n) > 0 if and only if A054054(n) > 0. a(n) = d in {1, ..., 9} if n = (10^k - 1)/9 + (d - 1)*10^m = A002275(k) + (d - 1)*A011557(m) for some k > m >= 0. The statement holds with "if and only if" for d in {1, 2, 3, 5, 7}. For d = 4, 6, 8 or 9, one has a(n) = d if n = (10^k - 1)/9 + (a - 1)*10^m + (b - 1)*10^p with integers k > m > p >= 0 and a, b > 0 such that d = a*b. - M. F. Hasler, Oct 11 2015
From Robert Israel, May 17 2016: (Start)
G.f.: Sum_{n >= 0} Product_{j = 0..n} Sum_{k = 1..9} k*x^(k*10^j).
G.f. satisfies A(x) = (x + 2*x^2 + ... + 9*x^9)*(1 + A(x^10)). (End)
a(n) <= 9^(1 + log_10(n/9)). - Lucas A. Brown, Jun 22 2023
Extensions
Error in term 25 corrected, Nov 15 1995
Comments