login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A215014 Numbers where any two consecutive decimal digits differ by 1 after arranging the digits in decreasing order. 4
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 102, 120, 123, 132, 201, 210, 213, 231, 234, 243, 312, 321, 324, 342, 345, 354, 423, 432, 435, 453, 456, 465, 534, 543, 546, 564, 567, 576, 645, 654, 657, 675, 678, 687, 756, 765, 768, 786, 789, 798, 867 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

COMMENTS

a(4091131) = 9876543210 is the last term.

Numbers n such that A004186(n) is a term of A033075. - Felix Fröhlich, Dec 26 2017

Also 0 together with positive integers having k distinct digits and the difference between the largest and the smallest digit equal to k-1. - David A. Corneth, Dec 26 2017

LINKS

Ely Golden, Table of n, a(n) for n = 1..10000

FORMULA

If zero is excluded, the number of terms with k digits, 1 <= k <= 10, is (11-k)*k! - (k-1)!. - Franklin T. Adams-Watters, Aug 01 2012

MATHEMATICA

lst = {}; Do[If[Times @@ Differences@Sort@IntegerDigits[n] == 1, AppendTo[lst, n]], {n, 0, 675}]; lst (* Arkadiusz Wesolowski, Aug 01 2012 *)

Join[Range[0, 9], Select[Range[1000], Union[Differences[Sort[ IntegerDigits[ #]]]] == {1}&]] (* Harvey P. Dale, Jan 14 2015 *)

PROG

(PARI) is(n)=my(v=vecsort(eval(Vec(Str(n))))); for(i=2, #v, if(v[i]!=1+v[i-1], return(0))); 1

(PARI) is(n) = if(!n, return(1)); my(d = digits(n), v = vecsort(d, , 8)); #d == #v && v[#v] - v[1] == #v - 1

(Python)

# Ely Golden, Dec 26 2017

def consecutive(li):

  for i in range(len(li)-1):

    if(li[i+1]!=1+li[i]): return False

  return True

def sorted_digits(n):

  lst=[]

  while(n>0):

    lst+=[n%10] ; n//=10

  lst.sort() ; return lst

j=0

for i in range(1, 10001):

  while(not consecutive(sorted_digits(j))): j+=1

  print(str(i)+" "+str(j)) ; j+=1

CROSSREFS

Cf. A004186, A033075.

Sequence in context: A271955 A255734 A033075 * A292439 A132577 A247167

Adjacent sequences:  A215011 A215012 A215013 * A215015 A215016 A215017

KEYWORD

nonn,base,fini

AUTHOR

Tanya Khovanova and Charles R Greathouse IV, Jul 31 2012

EXTENSIONS

Name edited by Felix Fröhlich, Dec 26 2017

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 19 13:08 EDT 2019. Contains 321330 sequences. (Running on oeis4.)