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.

Showing 1-2 of 2 results.

A051801 Product of the nonzero digits of n.

Original entry on oeis.org

1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2, 4, 6, 8, 10, 12, 14, 16, 18, 3, 3, 6, 9, 12, 15, 18, 21, 24, 27, 4, 4, 8, 12, 16, 20, 24, 28, 32, 36, 5, 5, 10, 15, 20, 25, 30, 35, 40, 45, 6, 6, 12, 18, 24, 30, 36, 42, 48, 54, 7, 7, 14, 21
Offset: 0

Views

Author

Dan Hoey, Dec 09 1999

Keywords

Examples

			a(0) = 1 since an empty product is 1 by convention. a(120) = 1*2 = 2.
		

Crossrefs

Basis for A051802.
See A338882 for similar sequences.
See also A007953 (digital sum).

Programs

  • Haskell
    a051801 0 = 1
    a051801 n = (a051801 n') * (m + 0 ^ m) where (n',m) = divMod n 10
    -- Reinhard Zumkeller, Nov 23 2011
    
  • Maple
    A051801 := proc(n) local d,j: d:=convert(n,base,10): return mul(`if`(d[j]=0,1,d[j]), j=1..nops(d)): end: seq(A051801(n),n=0..100); # Nathaniel Johnston, May 04 2011
  • Mathematica
    (Times@@Cases[IntegerDigits[#],Except[0]])&/@Range[0,80] (* Harvey P. Dale, Jun 20 2011 *)
    Table[Times@@(IntegerDigits[n]/.(0->1)),{n,0,80}] (* Harvey P. Dale, Apr 16 2023 *)
  • PARI
    a(n)=my(v=select(k->k>1,digits(n)));prod(i=1,#v,v[i]) \\ Charles R Greathouse IV, Nov 20 2012
    
  • Python
    from operator import mul
    from functools import reduce
    def A051801(n):
        return reduce(mul, (int(d) for d in str(n) if d != '0')) if n > 0 else 1 # Chai Wah Wu, Aug 23 2014
    
  • Python
    from math import prod
    def a(n): return prod(int(d) for d in str(n) if d != '0')
    print([a(n) for n in range(74)]) # Michael S. Branicky, Jul 18 2021
    
  • Swift
    // Swift 5
    A051801(n): String(n).compactMap{$0.wholeNumberValue == 0 ? 1 : $0.wholeNumberValue}.reduce(1, *) // Egor Khmara, Jan 15 2021

Formula

a(n) = 1 if n=0, otherwise a(floor(n/10)) * (n mod 10 + 0^(n mod 10)). - Reinhard Zumkeller, Oct 13 2009
G.f. A(x) satisfies: A(x) = (1 + x + 2*x^2 + 3*x^3 + 4*x^4 + 5*x^5 + 6*x^6 + 7*x^7 + 8*x^8 + 9*x^9) * A(x^10). - Ilya Gutkovskiy, Nov 14 2020
a(n) = A007954(A004719(n)). - Michel Marcus, Mar 07 2022

A117592 a(n) = a(3n) = a(3n+1) = a(3n+2)/2 with a(0)=1.

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 2, 2, 4, 1, 1, 2, 1, 1, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 4, 4, 8, 1, 1, 2, 1, 1, 2, 2, 2, 4, 1, 1, 2, 1, 1, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 4, 4, 8, 2, 2, 4, 2, 2, 4, 4, 4, 8, 2, 2, 4, 2, 2, 4, 4, 4
Offset: 0

Views

Author

Paul Barry, Apr 05 2006

Keywords

Comments

Row sums of number triangle A117944.
Product of the nonzero digits of (n written in base 3). - Ilya Gutkovskiy, Nov 15 2020
a(n) = 1, 2, 4, 8, 16, 32, 64 iff n is respectively in A005836, A023699, A023700, A023701, A023702, A023703, A023704. - Bernard Schott, Dec 04 2020

Crossrefs

See A338882 for similar sequences.
Cf. A081603 (log_2), A117942 (signed), A117944.

Programs

  • Mathematica
    Nest[ Join[#, #, 2#] &, {1}, 5] (* Robert G. Wilson v, Jul 27 2014 *)
  • PARI
    a(n) = 1 << hammingweight(digits(n,3)>>1); \\ Kevin Ryde, Nov 15 2020
    
  • Python
    from gmpy2 import digits
    def A117592(n): return 1<Chai Wah Wu, Dec 05 2024

Formula

a(n) = a(3n)/a(0) = a(3n+1)/a(1) = a(3n+2)/a(2).
a(n) = abs(A117942(n)).
G.f. A(x) satisfies: A(x) = (1 + x + 2*x^2) * A(x^3). - Ilya Gutkovskiy, Nov 15 2020
a(n) = 2^A081603(n). - Kevin Ryde, Nov 15 2020

Extensions

a(0) = 1 added to the Name by Bernard Schott, Dec 04 2020
Showing 1-2 of 2 results.