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-8 of 8 results.

A062329 a(n) = (sum of digits of n) - (product of digits of n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, 3, 1, -1, -3, -5, -7, -9, -11, -13, -15, 4, 1, -2, -5, -8, -11, -14, -17, -20, -23, 5, 1, -3, -7, -11, -15, -19, -23, -27, -31, 6, 1, -4, -9, -14, -19, -24, -29, -34, -39, 7, 1, -5, -11, -17, -23, -29, -35, -41, -47, 8, 1, -6, -13, -20, -27
Offset: 0

Views

Author

Amarnath Murthy, Jun 21 2001

Keywords

Examples

			a(23) = 2 + 3 - 2*3 = -1.
a(49) = -(4*9) + (4 + 9) = -36 + 13 = -23.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := (t = IntegerDigits[n]; Plus @@ t - Times @@ t); Table[ a[n], {n, 0, 75}] (* Robert G. Wilson v *)

Extensions

Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 22 2001
Signed version from Henry Bottomley, Jun 29 2001

A178500 a(n) = 10^n * signum(n).

Original entry on oeis.org

0, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000, 100000000000000000, 1000000000000000000, 10000000000000000000, 100000000000000000000
Offset: 0

Views

Author

Reinhard Zumkeller, May 28 2010

Keywords

Comments

a(n-1) is the minimum difference between an n-digit number (written in base 10, nonzero leading digit) and the product of its digits. For n > 1, it is also a number meeting that bound. See A070565. - Devin Akman, Apr 17 2019

Crossrefs

Programs

Formula

a(n) = A011557(n)*A057427(n).
For n > 0, a(n) = A011557(n).
a(n) = 10*A178501(n).
a(n) = A000533(n) - 1.
A061601(a(n)) = A109002(n+1).
From Elmo R. Oliveira, Jul 21 2025: (Start)
G.f.: 10*x/(1-10*x).
E.g.f.: 2*exp(5*x)*sinh(5*x).
a(n) = 10*a(n-1) for n > 1. (End)

A229547 Numbers n such that n - product_of_digits(n) is a palindrome.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 29, 34, 46, 57, 61, 78, 82, 93, 101, 129, 143, 187, 202, 218, 226, 244, 247, 252, 269, 294, 297, 303, 319, 336, 348, 357, 361, 364, 386, 404, 412, 419, 437, 453, 462, 488, 505, 514, 519, 524, 534, 539, 544, 554, 564, 574, 584, 594, 597, 606, 613, 615, 617, 619, 625, 635, 638, 645, 655, 663
Offset: 1

Views

Author

Derek Orr, Sep 26 2013

Keywords

Examples

			143 - (1*4*3) = 131 (a palindrome). So, 143 is a member of the sequence.
		

Crossrefs

Cf. A070565.

Programs

  • Mathematica
    f[n_] := Block[{d = n - Times @@ IntegerDigits@ n}, d == FromDigits@ Reverse[IntegerDigits@ d]]; Select[Range[0, 1000], f] (* Michael De Vlieger, Mar 12 2015 *)
  • PARI
    for(n=0,10^3,d=digits(n);p=prod(i=1,#d,d[i]);if(Vecrev(digits(n-p))==digits(n-p),print1(n,", "))) \\ Derek Orr, Mar 12 2015
  • Python
    def rev(n):
        return int(''.join(reversed(str(n))))
    def DP(n):
        p = 1
        for i in str(n):
            p *= int(i)
        return p
    {print(n, end=', ') for n in range(10**3) if n-DP(n)==rev(n-DP(n))}
    # Simplified by Derek Orr, Mar 12 2015
    

Extensions

More terms from Derek Orr, Mar 12 2015

A124167 a(n) = 10*(10^n-1).

Original entry on oeis.org

0, 90, 990, 9990, 99990, 999990, 9999990, 99999990, 999999990, 9999999990, 99999999990, 999999999990, 9999999999990, 99999999999990, 999999999999990, 9999999999999990, 99999999999999990, 999999999999999990
Offset: 0

Views

Author

Zerinvary Lajos, Dec 02 2006

Keywords

Comments

a(n - 1) is the maximum difference between an n-digit number (written in base 10, nonzero leading digit) and the product of its digits. For n>1, it is also a number meeting that bound. See A070565. - Devin Akman, Apr 17 2019

Crossrefs

Partial sums give 10*A099676.

Programs

  • GAP
    List([0..20], n-> 10*(10^n -1)); # G. C. Greubel, Jun 30 2019
  • Magma
    [10*(10^n -1): n in [0..20]]; // G. C. Greubel, Jun 30 2019
    
  • Maple
    a:=n->sum (10^(n-j+2)-10^(n-j+1),j=0..n): seq(a(n),n=0..20);
  • Mathematica
    Array[10 (10^# - 1) &, 20, 0] (* Michael De Vlieger, Apr 21 2019 *)
  • PARI
    vector(20, n, n--; 10*(10^n -1)) \\ G. C. Greubel, Jun 30 2019
    
  • Sage
    [10*(10^n -1) for n in (0..20)] # G. C. Greubel, Jun 30 2019
    

Formula

a(n) = 10*A002283(n).
From G. C. Greubel, Jun 30 2019: (Start)
a(n) = 90*A002275(n).
a(n) = 11*a(n-1) - 10*a(n-2).
G.f.: 10*(1/(1-10*x) - 1/(1-x)).
E.g.f.: 10*(exp(10*x) - exp(x)). (End)

A134942 Numbers m such that there exists no number k with k-P(k) = m, where P(k) is the product of digits of k written in base 10.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 23, 27, 29, 32, 33, 36, 39, 41, 43, 44, 47, 48, 49, 51, 53, 54, 56, 57, 61, 62, 63, 65, 67, 68, 69, 71, 72, 75, 76, 77, 78, 79, 81, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99, 121, 123, 127, 129, 132, 133, 136, 139, 141, 143
Offset: 1

Views

Author

Philippe Lallouet (philip.lallouet(AT)orange.fr), Feb 01 2008

Keywords

Comments

Obviously no number containing a zero digit is in the sequence.

Examples

			For 0 <= p <= 9, p - P(p) = 0, hence 0 is not in the sequence.
It's easy to see that if p has 2 digits or more the difference p - P(p) has at least 2 digits, hence 1 to 9 are in the sequence.
		

Crossrefs

Cf. A070565.

Programs

  • Maple
    f:= n -> n - convert(convert(n,base,10),`*`):
    R:= {}:
    S:= {0}:
    for d from 1 to 3 do
      S:= map(proc(t) local i; seq(10*t+i,i=1..9) end proc, S);
      V:= S minus map(f, S);
      R:= R union V;
    od:
    sort(convert(R,list)); # Robert Israel, Jul 22 2025

Extensions

Corrected by Robert Israel, Jul 22 2025

A336383 a(n) is the smallest number such that, with f(x) = x - (the product of the digits of x), f(a(n)) reaches a fixed point after n iterations.

Original entry on oeis.org

0, 1, 21, 31, 42, 52, 73, 81, 319, 391, 463, 583, 2911, 3667, 6451, 8793, 9927, 237126, 254158, 278393, 2561363, 9398143, 9431623, 9951265, 83543869, 83896381, 83935261, 2843233127, 2847297383, 2853748583, 2885762663, 266998137657, 685718563667, 688373877587
Offset: 0

Views

Author

Alon Ran, Jul 19 2020

Keywords

Comments

A fixed point occurs once the function returns a number that contains the digit 0. After that, the product of the digits will be 0, and so subtracting it from the number will be idempotent.
This sequence is conceptually similar to A003001, though unlike the latter, it is probably infinite.

Examples

			a(9) = 391 because:
   1: 391 - 3*9*1 = 364
   2: 364 - 3*6*4 = 292
   3: 292 - 2*9*2 = 256
   4: 256 - 2*5*6 = 196
   5: 196 - 1*9*6 = 142
   6: 142 - 1*4*2 = 134
   7: 134 - 1*3*4 = 122
   8: 122 - 1*2*2 = 118
   9: 118 - 1*1*8 = 110
After iteration 9, the function becomes idempotent:
  10: 110 - 1*1*0 = 110
  11: 110 - 1*1*0 = 110
  12: 110 - 1*1*0 = 110
  ...
Additionally, 391 is the smallest number with this property. Thus, it is a(9).
		

Crossrefs

Programs

  • Mathematica
    nmax = 20; tab = ConstantArray[Null, nmax];
    For[k = 0, k <= 1000000, k++,
     l=Length@  NestWhileList[#-Times @@ IntegerDigits[#] &,k,UnsameQ[##] &, 2]-2;
    If[tab[[l+1]] == Null, tab[[l+1]] = k]]; tab  (* Robert Price, Sep 13 2020 *)
  • PARI
    f(m) = m - vecprod(digits(m)) + (m==0);
    lista(nn) = {my(c, m, t); for(k=0, nn, c=0; m=k; while(m!=(m=f(m)), c++); if(c==t, print1(k, ", "); t++)); } \\ Jinyuan Wang, Aug 14 2020
  • Python
    def f(x):
        prod = 1
        for digit in str(x):
            prod *= int(digit)
        return x - prod
    def a(n):
        i = 0
        iteration = 0
        while iteration != n:
            i += 1
            j = i
            iteration = 0
            new_j = f(j)
            while j != new_j:
                iteration += 1
                j = new_j
                new_j = f(j)
        return i
    

Extensions

a(27)-a(30) from Jinyuan Wang, Aug 14 2020
a(31)-a(33) added by Michael S. Branicky, Aug 29 2020

A336682 a(n) is the number of iterations needed to reach a fixed point starting with n and repeatedly applying f(x) = x - (the product of the digits of x).

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 3, 3, 3, 3, 1, 2, 2, 2, 2, 0, 3, 4, 4, 3, 3, 3, 2, 2, 2, 0, 4, 5, 3, 4, 1, 3, 3, 2, 2, 0, 2, 1, 4, 1, 2, 1, 3, 1, 2, 0, 2, 3, 6, 4, 1, 4, 3, 3, 2, 0, 7, 2, 3, 6, 4
Offset: 0

Views

Author

Robert Price, Sep 13 2020

Keywords

Examples

			a(42) = 4 because:
1: 42 - 4*2 = 34
2: 34 - 3*4 = 22
3: 22 - 2*2 = 18
4: 18 - 1*8 = 10
5: 10 - 1*0 = 10
		

Crossrefs

Programs

  • Mathematica
    Table[Length@  NestWhileList[# - Times @@ IntegerDigits[#] &, n, UnsameQ[##] &,
    2] - 2, {n, 0, 85}];(* Robert Price, Sep 13 2020 *)

A376257 a(n) = (n - c(n))*(-1)^c(n), where c(n) is the product of the digits of n (A007954).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 10, -10, 10, -10, 10, -10, 10, -10, 10, -10, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 30, -28, 26, -24, 22, -20, 18, -16, 14, -12, 40, 37, 34, 31, 28, 25, 22, 19, 16, 13, 50, -46, 42, -38, 34, -30, 26, -22, 18, -14, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 70, -64, 58
Offset: 1

Views

Author

Stuart Coe, Sep 17 2024

Keywords

Comments

There is an interesting pattern on the graph of the sequence.

Examples

			For n = 129: 1*2*9=18. So a(n) = (129-18)*(-1)^18 = 111.
		

Crossrefs

Programs

  • Mathematica
    A376257[n_] := (n - #)*(-1)^# & [Times @@ IntegerDigits[n]];
    Array[A376257, 100] (* Paolo Xausa, Dec 10 2024 *)

Formula

a(n) = (n-A007954(n)) * (-1)^A007954(n).
Showing 1-8 of 8 results.