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.

A215014 Numbers where any two consecutive decimal digits differ by 1 after arranging the digits in decreasing order.

This page as a plain text file.
%I A215014 #44 Aug 04 2022 15:04:11
%S A215014 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,
%T A215014 98,102,120,123,132,201,210,213,231,234,243,312,321,324,342,345,354,
%U A215014 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
%N A215014 Numbers where any two consecutive decimal digits differ by 1 after arranging the digits in decreasing order.
%C A215014 a(4091131) = 9876543210 is the last term.
%C A215014 Numbers n such that A004186(n) is a term of A033075. - _Felix Fröhlich_, Dec 26 2017
%C A215014 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
%H A215014 Ely Golden, <a href="/A215014/b215014.txt">Table of n, a(n) for n = 1..10000</a>
%F A215014 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
%t A215014 lst = {}; Do[If[Times @@ Differences@Sort@IntegerDigits[n] == 1, AppendTo[lst, n]], {n, 0, 675}]; lst (* _Arkadiusz Wesolowski_, Aug 01 2012 *)
%t A215014 Join[Range[0,9],Select[Range[1000],Union[Differences[Sort[ IntegerDigits[ #]]]] == {1}&]] (* _Harvey P. Dale_, Jan 14 2015 *)
%o A215014 (PARI) is(n)=my(v=vecsort(eval(Vec(Str(n)))));for(i=2,#v,if(v[i]!=1+v[i-1],return(0)));1
%o A215014 (PARI) is(n) = if(!n, return(1)); my(d = digits(n), v = vecsort(d,,8)); #d == #v && v[#v] - v[1] == #v - 1
%o A215014 (Python)
%o A215014 # _Ely Golden_, Dec 26 2017
%o A215014 def consecutive(li):
%o A215014   for i in range(len(li)-1):
%o A215014     if(li[i+1]!=1+li[i]): return False
%o A215014   return True
%o A215014 def sorted_digits(n):
%o A215014   lst=[]
%o A215014   while(n>0):
%o A215014     lst+=[n%10] ; n//=10
%o A215014   lst.sort() ; return lst
%o A215014 j=0
%o A215014 for i in range(1,10001):
%o A215014   while(not consecutive(sorted_digits(j))): j+=1
%o A215014   print(str(i)+" "+str(j)) ; j+=1
%o A215014 (Python) # alternate for generating full sequence in seconds
%o A215014 from itertools import permutations as perms
%o A215014 frags = ["0123456789"[i:j] for i in range(10) for j in range(i+1, 11)]
%o A215014 afull = sorted(set(int("".join(s)) for f in frags for s in perms(f)))
%o A215014 print(afull[:70]) # _Michael S. Branicky_, Aug 04 2022
%Y A215014 Cf. A004186, A033075.
%K A215014 nonn,base,fini
%O A215014 1,3
%A A215014 _Tanya Khovanova_ and _Charles R Greathouse IV_, Jul 31 2012
%E A215014 Name edited by _Felix Fröhlich_, Dec 26 2017