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-10 of 26 results. Next

A072817 Accumulative sum of the greatest digit of n minus the least digit of n (A037904) <= 10^n.

Original entry on oeis.org

1, 286, 4621, 56980, 640663, 6904678, 72722233, 755339992, 7774461355, 79520082490, 809705785165, 8217213032524, 83178920046367, 840306174900622, 8475694265094817, 85380606857454976, 859192675118710099, 8638686211723117474, 86794540082486097589, 871513270875022245748
Offset: 1

Views

Author

Keywords

Comments

Let b(n) = sum( A037904(k),{k=1..n}), then the lim b(n)/n -> 9. Reason, as the number of digits increases, then the likelihood of the maximum digit -> 9 and the minimum digits -> 0 becomes one.

Crossrefs

Cf. A037904.

Programs

  • Mathematica
    f[n_] := Block[{d = IntegerDigits[n]}, Max[d] - Min[d]]; s = 0; k = 0; Do[ While[k != 10^n, k++; s = s + f[k]]; Print[s], {n, 1, 8}]
  • PARI
    a(n)={1 + sum(w=1, n, sum(k=1, 9, (10-k)*k*((k+1)^w - 2*k^w + (k-1)^w) - k*((k+1)^(w-1) - k^(w-1))))} \\ Andrew Howroyd, Jan 28 2020

Formula

a(n) = 1 + Sum_{w=1..n} Sum_{k=1..9} (10-k)*k*((k+1)^w - 2*k^w + (k-1)^w) - k*((k+1)^(w-1) - k^(w-1)). - Andrew Howroyd, Jan 28 2020

Extensions

a(9)-a(12) from Donovan Johnson, Apr 09 2010
Terms a(13) and beyond from Andrew Howroyd, Jan 28 2020

A072830 Absolute value of 2*b(n)-9*n, where b(n) = accumulative sum of the greatest digit of n minus the least digit of n (A037904).

Original entry on oeis.org

9, 18, 27, 36, 45, 54, 63, 72, 81, 88, 97, 104, 109, 112, 113, 112, 109, 104, 97, 102, 109, 118, 125, 130, 133, 134, 133, 130, 125, 128, 133, 140, 149, 156, 161, 164, 165, 164, 161, 162, 165, 170, 177, 186, 193, 198, 201, 202, 201, 200, 201, 204, 209, 216
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A037904.

Programs

  • Mathematica
    f[n_] := Block[{d = IntegerDigits[n]}, Max[d] - Min[d]]; b[n_] := b[n] = b[n - 1] + f[n]; b[1] = 0; a[n_] := a[n] = Abs[2b[n] - 9*n]; Table[ a[n], {n, 1, 65}]
    gdmld[n_]:=Module[{idn=IntegerDigits[n]},Max[idn]-Min[idn]]; Module[ {nn=60,gd}, gd=Accumulate[gdmld/@Range[nn]];Abs[ 2*Last[#]- 9*First[ #]]&/@Thread[{Range[nn],gd}]]

Formula

Let b(n) = sum( A037904(k), {k=1..n}), a(n) = |2*b(n) - 9*n|.

Extensions

Definition clarified by Harvey P. Dale, May 21 2014

A000030 Initial digit of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

When n - a(n)*10^[log_10 n] >= 10^[(log_10 n) - 1], where [] denotes floor, or when n < 100 and 10|n, n is the concatenation of a(n) and A217657(n). - Reinhard Zumkeller, Oct 10 2012, improved by M. F. Hasler, Nov 17 2018, and corrected by Glen Whitney, Jul 01 2022
Equivalent definition: The initial a(0) = 0 is followed by each digit in S = {1,...,9} once. Thereafter, repeat 10 times each digit in S. Then, repeat 100 times each digit in S, etc.

Examples

			23 begins with a 2, so a(23) = 2.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a000030 = until (< 10) (`div` 10) -- Reinhard Zumkeller, Feb 20 2012, Feb 11 2011
    
  • Magma
    [Intseq(n)[#Intseq(n)]: n in [1..100]]; // Vincenzo Librandi, Nov 17 2018
    
  • Maple
    A000030 := proc(n)
        if n = 0 then
            0;
        else
            convert(n,base,10) ;
            %[-1] ;
        end if;
    end proc:
    seq(A000030(n),n=0..200) ;# N. J. A. Sloane, Feb 10 2017
  • Mathematica
    Join[{0},First[IntegerDigits[#]]&/@Range[90]] (* Harvey P. Dale, Mar 01 2011 *)
    Table[Floor[n/10^(Floor[Log10[n]])], {n, 1, 50}] (* G. C. Greubel, May 16 2017 *)
    Table[NumberDigit[n,IntegerLength[n]-1],{n,0,100}] (* Harvey P. Dale, Aug 29 2021 *)
  • PARI
    a(n)=if(n<10,n,a(n\10)) \\ Mainly for illustration.
    
  • PARI
    A000030(n)=n\10^logint(n+!n,10) \\ Twice as fast as a(n)=digits(n)[1]. Before digits() was added in PARI v.2.6.0 (2013), one could use, e.g., Vecsmall(Str(n))[1]-48. - M. F. Hasler, Nov 17 2018
    
  • Python
    def a(n): return int(str(n)[0])
    print([a(n) for n in range(85)]) # Michael S. Branicky, Jul 01 2022

Formula

a(n) = [n / 10^([log_10(n)])] where [] denotes floor and log_10(n) is the logarithm is base 10. - Dan Fux (dan.fux(AT)OpenGaia.com or danfux(AT)OpenGaia.com), Apr 07 2001
a(n) = k for k*10^j <= n < (k+1)*10^j for some j. - M. F. Hasler, Mar 23 2015

A010785 Repdigit numbers, or numbers whose digits are all equal.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 111, 222, 333, 444, 555, 666, 777, 888, 999, 1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 11111, 22222, 33333, 44444, 55555, 66666, 77777, 88888, 99999, 111111, 222222, 333333, 444444, 555555, 666666
Offset: 0

Views

Author

Keywords

Comments

Complement of A139819. - David Wasserman, May 21 2008
Subsequence of A134336 and of A178403. - Reinhard Zumkeller, May 27 2010
Subsequence of A193460. - Reinhard Zumkeller, Jul 26 2011
Intersection of A009994 and A009996. - David F. Marrs, Sep 29 2018
Beiler (1964) called these numbers "monodigit numbers". The term "repdigit numbers" was used by Trigg (1974). - Amiram Eldar, Jan 21 2022

References

  • Albert H. Beiler, Recreations in the Theory of Numbers, Dover, New York, 1964, p. 83.

Crossrefs

Programs

  • Haskell
    a010785 n = a010785_list !! n
    a010785_list = 0 : r [1..9] where
       r (x:xs) = x : r (xs ++ [10*x + x `mod` 10])
    -- Reinhard Zumkeller, Jul 26 2011
    
  • Magma
    [(n-9*Floor((n-1)/9))*(10^Floor((n+8)/9)-1)/9: n in [0..50]]; // Vincenzo Librandi, Nov 10 2014
    
  • Maple
    A010785 := proc(n)
        (n-9*floor(((n-1)/9)))*((10^(floor(((n+8)/9)))-1)/9) ;
    end proc:
    seq(A010785(n), n = 0 .. 100); # Robert Israel, Nov 09 2014
  • Mathematica
    fQ[n_]:=Module[{id=IntegerDigits[n]}, Length[Union[id]]==1]; Select[Range[0,10000], fQ] (* Vladimir Joseph Stephan Orlovsky, Dec 29 2010 *)
    Union[FromDigits/@Flatten[Table[PadRight[{},i,n],{n,0,9},{i,6}],1]] (* or *) LinearRecurrence[{0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,-10}, {0,1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88},40] (* Harvey P. Dale, Dec 28 2011 *)
    Union@ Flatten@ Table[k (10^n - 1)/9, {k, 0, 9}, {n, 6}] (* Robert G. Wilson v, Oct 09 2014 *)
    Table[(n - 9 Floor[(n-1)/9]) (10^Floor[(n+8)/9] - 1)/9, {n, 0, 50}] (* José de Jesús Camacho Medina, Nov 06 2014 *)
  • PARI
    a(n)=10^((n+8)\9)\9*((n-1)%9+1) \\ Charles R Greathouse IV, Jun 15 2011
    
  • PARI
    nxt(n,t=n%10)=if(t<9,n*(t+1),n*10+9)\t \\ Yields the term a(k+1) following a given term a(k)=n. M. F. Hasler, Jun 24 2016
    
  • PARI
    is(n)={1==#Set(digits(n))}
    inv(n) = 9*#Str(n) + n%10 - 9 \\ David A. Corneth, Jun 24 2016
    
  • Python
    def a(n): return 0 if n == 0 else int(str((n-1)%9+1)*((n-1)//9+1))
    print([a(n) for n in range(55)]) # Michael S. Branicky, Dec 29 2021
    
  • Python
    print([0]+[int(d*r) for r in range(1, 7) for d in "123456789"]) # Michael S. Branicky, Dec 29 2021
    
  • Python
    # without string operations
    def a(n): return 0 if n == 0 else (10**((n-1)//9+1)-1)//9*((n-1)%9+1)
    print([a(n) for n in range(55)]) # Michael S. Branicky, Nov 03 2023

Formula

A037904(a(n)) = 0. - Reinhard Zumkeller, Dec 14 2007
A178401(a(n)) > 0. - Reinhard Zumkeller, May 27 2010
From Reinhard Zumkeller, Jul 26 2011: (Start)
For n > 0: A193459(a(n)) = A000005(a(n)).
for n > 10: a(n) mod 10 = floor(a(n)/10) mod 10.
A010879(n) = A010879(A059995(n)). (End)
A202022(a(n)) = 1. - Reinhard Zumkeller, Dec 09 2011
a(0)=0, a(1)=1, a(2)=2, a(3)=3, a(4)=4, a(5)=5, a(6)=6, a(7)=7, a(8)=8, a(9)=9, a(10)=11, a(11)=22, a(12)=33, a(13)=44, a(14)=55, a(15)=66, a(16)=77, a(17)=88, a(n) = 11*a(n-9) - 10*a(n-18). - Harvey P. Dale, Dec 28 2011
A151949(a(n)) = 0; A180410(a(n)) = A227362(a(n)). - Reinhard Zumkeller, Jul 09 2013
a(n) = (n - 9*floor((n-1)/9))*(10^floor((n+8)/9) - 1)/9. - José de Jesús Camacho Medina, Nov 06 2014
G.f.: x*(1+2*x+3*x^2+4*x^3+5*x^4+6*x^5+7*x^6+8*x^7+9*x^8)/((1-x^9)*(1-10*x^9)). - Robert Israel, Nov 09 2014
A047842(a(n)) = A244112(a(n)). - Reinhard Zumkeller, Nov 11 2014
Sum_{n>=1} 1/a(n) = (7129/2520) * A065444 = 3.11446261209177581335... - Amiram Eldar, Jan 21 2022

Extensions

Name clarified by Jon E. Schoenfield, Nov 10 2023

A040115 Concatenate absolute values of differences between adjacent digits of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1
Offset: 0

Views

Author

Keywords

Comments

Let the decimal expansion of n be abcd...efg, say. Then a(n) has decimal expansion |a-b| |b-c| |c-d| ... |e-f| |f-g|. Leading zeros in a(n) are omitted.
From M. F. Hasler, Nov 09 2019: (Start)
This sequence coincides with A080465 up to a(109) but is thereafter completely different.
Eric Angelini calls a(n) the "ghost" of the number n and considers iterations of n -> n +- a(n) depending on parity of a(n), cf. A329200 and A329201. (End)

Examples

			a(371) = 46, for example.
a(110) = 01 = 1, while A080465(110) = 10 - 1 = 9. - _M. F. Hasler_, Nov 09 2019
		

Crossrefs

Cf. A329200, A329201: iterations of n +- a(n).

Programs

  • Mathematica
    Table[FromDigits[Abs[Differences[IntegerDigits[n]]]],{n,110}] (* Harvey P. Dale, Dec 16 2021 *)
  • PARI
    apply( A040115(n)=fromdigits(abs((n=digits(n+!n))[^-1]-n[^1])), [10..199]) \\ Works for all n >= 0. - M. F. Hasler, Nov 09 2019

Formula

a(n) = 0 iff n is a repdigit >= 11 (A010785). - Bernard Schott, May 09 2022

Extensions

Definition clarified by N. J. A. Sloane, Aug 19 2008
Name edited by M. F. Hasler, Nov 09 2019
Terms a(0) = a(1) = ... = a(9) = 0 prepended by Max Alekseyev, Jul 26 2024

A040997 Absolute value of first digit of n minus sum of other digits of n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Offset: 1

Views

Author

Keywords

Comments

This is different from |A055017(n)| = |(x1 + x3 + ...) - (x2 + x4 + ...)|, where x1,...,xk are the digits of n. - M. F. Hasler, Nov 09 2019

Examples

			a(371) = |3-7-1| = 5.
		

Crossrefs

Programs

  • Haskell
    a040997 n = abs $ a000030 n - a007953 (a217657 n) -- Reinhard Zumkeller, Oct 10 2012
    
  • PARI
    apply( A040997(n)={abs(vecsum(n=digits(n))-n[1]*2)}, [1..199]) \\ M. F. Hasler, Nov 09 2019

Formula

If decimal expansion of n is x1 x2 ... xk then a(n) = |x1-x2-x3- ... -xk|.
a(n) = abs(A000030(n) - A007953(A217657(n))). - Reinhard Zumkeller, Oct 10 2012

Extensions

Name edited and incorrect formula deleted by M. F. Hasler, Nov 09 2019

A064834 If n (in base 10) is d_1 d_2 ... d_k then a(n) = Sum_{i = 1..[k/2] } |d_i - d_{k-i+1}|.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 25 2001

Keywords

Comments

Might be called the Palindromic Deviation (or PD(n)) of n, since it measures how far n is from being a palindrome. - W. W. Kokko, Mar 13 2013
a(A002113(n)) = 0; a(A029742(n)) > 0; A136522(n) = A000007(a(n)). - Reinhard Zumkeller, Sep 18 2013

Examples

			a(456) = | 4 - 6 | = 2, a(4567) = | 4 - 7 | + | 5 - 6 | = 4.
		

Crossrefs

Programs

  • Haskell
    a064834 n = sum $ take (length nds `div` 2) $
                      map abs $ zipWith (-) nds $ reverse nds
       where nds = a031298_row n
    -- Reinhard Zumkeller, Sep 18 2013
    
  • Maple
    f:=proc(n)
    local t1,t2,i;
    t1:=convert(n,base,10);
    t2:=nops(t1);
    add( abs(t1[i]-t1[t2+1-i]),i=1..floor(t2/2) );
    end;
    [seq(f(n),n=0..120)]; # N. J. A. Sloane, Mar 24 2013
  • Mathematica
    f[n_] := (k = IntegerDigits[n]; l = Length[k]; Sum[ Abs[ k[[i]] - k[[l - i + 1]]], {i, 1, Floor[l/2] } ] ); Table[ f[n], {n, 0, 100} ]
  • Python
    from sympy import floor, ceiling
    def A064834(n):
        x, y = str(n), 0
        lx2 = len(x)/2
        for a,b in zip(x[:floor(lx2)],x[:ceiling(lx2)-1:-1]):
            y += abs(int(a)-int(b))
        return y
    # Chai Wah Wu, Aug 09 2014

Extensions

More terms from Vladeta Jovovic, Matthew Conroy and Robert G. Wilson v, Oct 26 2001

A366959 Numbers whose difference between the largest and smallest digits is equal to 2.

Original entry on oeis.org

13, 20, 24, 31, 35, 42, 46, 53, 57, 64, 68, 75, 79, 86, 97, 102, 113, 120, 123, 131, 132, 133, 200, 201, 202, 210, 213, 220, 224, 231, 234, 242, 243, 244, 311, 312, 313, 321, 324, 331, 335, 342, 345, 353, 354, 355, 422, 423, 424, 432, 435, 442, 446, 453, 456, 464, 465, 466
Offset: 1

Views

Author

Stefano Spezia, Oct 30 2023

Keywords

Comments

The number of n-digit terms of this sequence is (46*3^n - 93*2^n + 48)/6.

Crossrefs

Cf. A037904.
Cf. A010785 (difference = 0), A366958 (difference = 1), A366960 (difference = 3), A366961 (difference = 4), A366962 (difference = 5), A366963 (difference = 6), A366964 (difference = 7), A366965 (difference = 8), A366966 (difference = 9).

Programs

  • Maple
    F:= proc(d) local L,i;
       L:= select(t -> max(t) = 2 and min(t) = 0, map(convert,[$3^d..2*3^d-1],base,3));
       L:= map(t -> add(t[-i-1]*10^(i-1),i=1..nops(t)-1),L);
       L:= map(t -> seq(t+i*(10^d-1)/9,i=0..7), L);
       op(sort(select(t -> t >= 10^(d-1), L)));
    end proc:
    F(2), F(3), F(4); # Robert Israel, Nov 10 2023
  • Mathematica
    Select[Range[500],Max[d=IntegerDigits[#]]-Min[d]==2 &]
  • PARI
    isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 2; \\ Michel Marcus, Nov 05 2023
  • Python
    def ok(n): return max(d:=list(map(int, str(n))))-min(d) == 2
    print([k for k in range(500) if ok(k)]) # Michael S. Branicky, Oct 30 2023
    
  • Python
    from itertools import chain, count, islice, combinations_with_replacement
    from sympy.utilities.iterables import multiset_permutations
    def A366959_gen(): # generator of terms
        return chain.from_iterable(sorted(int(''.join(str(d) for d in t)) for a in range(8) for c in combinations_with_replacement(range(a,a+3),l) for t in multiset_permutations((a,a+2)+c) if t[0]) for l in count(0))
    A366959_list = list(islice(A366959_gen(),30)) # Chai Wah Wu, Nov 10 2023
    

A366960 Numbers whose difference between the largest and smallest digits is equal to 3.

Original entry on oeis.org

14, 25, 30, 36, 41, 47, 52, 58, 63, 69, 74, 85, 96, 103, 114, 124, 130, 134, 141, 142, 143, 144, 203, 214, 225, 230, 235, 241, 245, 252, 253, 254, 255, 300, 301, 302, 303, 310, 314, 320, 325, 330, 336, 341, 346, 352, 356, 363, 364, 365, 366, 411, 412, 413, 414
Offset: 1

Views

Author

Stefano Spezia, Oct 30 2023

Keywords

Comments

The number of n-digit terms of this sequence is 27*4^(n-1) - 41*3^(n-1) + 7*2^n.

Crossrefs

Cf. A037904.
Cf. A010785 (difference = 0), A366958 (difference = 1), A366959 (difference = 2), A366961 (difference = 4), A366962 (difference = 5), A366963 (difference = 6), A366964 (difference = 7), A366965 (difference = 8), A366966 (difference = 9).

Programs

  • Mathematica
    Select[Range[415],Max[d=IntegerDigits[#]]-Min[d]==3 &]
  • PARI
    isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 3; \\ Michel Marcus, Nov 05 2023
  • Python
    def ok(n): return max(d:=list(map(int, str(n))))-min(d) == 3
    print([k for k in range(420) if ok(k)]) # Michael S. Branicky, Oct 30 2023
    
  • Python
    from itertools import chain, count, islice, combinations_with_replacement
    from sympy.utilities.iterables import multiset_permutations
    def A366960_gen(): # generator of terms
        return chain.from_iterable(sorted(int(''.join(str(d) for d in t)) for a in range(7) for c in combinations_with_replacement(range(a,a+4),l) for t in multiset_permutations((a,a+3)+c) if t[0]) for l in count(0))
    A366960_list = list(islice(A366960_gen(),30)) # Chai Wah Wu, Nov 10 2023
    

A366961 Numbers whose difference between the largest and smallest digits is equal to 4.

Original entry on oeis.org

15, 26, 37, 40, 48, 51, 59, 62, 73, 84, 95, 104, 115, 125, 135, 140, 145, 151, 152, 153, 154, 155, 204, 215, 226, 236, 240, 246, 251, 256, 262, 263, 264, 265, 266, 304, 315, 326, 337, 340, 347, 351, 357, 362, 367, 373, 374, 375, 376, 377, 400, 401, 402, 403, 404, 410
Offset: 1

Views

Author

Stefano Spezia, Oct 30 2023

Keywords

Comments

The number of n-digit terms is 29*5^(n-1) - 47*4^(n-1) + 2*3^(n+1).

Crossrefs

Cf. A037904.
Cf. A010785 (difference = 0), A366958 (difference = 1), A366959 (difference = 2), A366960 (difference = 3), A366962 (difference = 5), A366963 (difference = 6), A366964 (difference = 7), A366965 (difference = 8), A366966 (difference = 9).

Programs

  • Mathematica
    Select[Range[410],Max[d=IntegerDigits[#]]-Min[d]==4 &]
  • PARI
    isok(n) = my(d=digits(n)); vecmax(d) - vecmin(d) == 4; \\ Michel Marcus, Nov 05 2023
  • Python
    def ok(n): return max(d:=list(map(int, str(n))))-min(d) == 4
    print([k for k in range(411) if ok(k)]) # Michael S. Branicky, Oct 30 2023
    
Showing 1-10 of 26 results. Next