%I #22 Aug 12 2018 13:58:48
%S 0,7,28,135,391,992,5837,9485,15975,244178
%N Smallest number m such that 2^m contains a string of n consecutive increasing digits in its decimal representation.
%C This is an increasing sequence (but not necessarily strictly increasing).
%e 7 is the smallest exponent such that 2^7 contains two consecutive increasing digits (2^7 = 128).
%e 28 is the smallest exponent such that 2^28 ( = 268435456) contains three consecutive increasing digits (456).
%e a(6) = 992 from 2^992 =
%e 418558049682135672245478534789063207250548754572474065407714995457168379_345\
%e 678_17284890561672488119458109166910841919797858872862722356017328064756\
%e 15116630782786940537040715228680107267602488727296075852403533779290461\
%e 69580757764357779904060393635270100437362409630553424235540298930640110\
%e 82834640896 - _N. J. A. Sloane_, Aug 12 2018
%t a[1]=0; a[n_] := Block[{k = 4, p = 16}, While[Max[ Length /@ Select[ Split@ Differences@ IntegerDigits@p, First@# == 1 &]] < n-1, k++; p *= 2]; k]; a/@ Range[7] (* _Giovanni Resta_, Feb 26 2014 *)
%o (Python)
%o def Str(x):
%o ..for n in range(10**5):
%o ....count = 0
%o ....i = 0
%o ....if len(str(2**n)) == x and x == 1:
%o ......return n
%o ....while i < len(str(2**n))-1:
%o ......if int(str(2**n)[i]) == int(str(2**n)[i+1])-1:
%o ........count += 1
%o ........i += 1
%o ......else:
%o ........if count == x-1:
%o ..........return n
%o ........else:
%o ..........count = 0
%o ..........i += 1
%o ....if count == x-1:
%o ......return n
%o x = 1
%o while x < 50:
%o ..print(Str(x))
%o ..x += 1
%Y Cf. A045875.
%K nonn,base,fini,full
%O 1,2
%A _Derek Orr_, Feb 26 2014
%E a(8)-a(10) from _Giovanni Resta_, Feb 26 2014
%E Definition and examples corrected ("integers" changed to "digits") by _N. J. A. Sloane_, Aug 12 2018
|