%I #6 Feb 26 2014 18:28:45
%S 0,5,25,78,161,341,1315,28238,56047,283789
%N Smallest numbers m such that 2^m contains a string of n consecutive decreasing integers in its decimal representation.
%C This is an increasing sequence (not necessarily strictly increasing).
%e 5 is the smallest exponent such that 2^5 contains two consecutive decreasing integers (2^5 = 32).
%e 25 is the smallest exponent such that 2^25 contains three consecutive decreasing integers (2^25 = 33554432).
%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 StrDec(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(StrDec(x))
%o ..x += 1
%Y Cf. A045875, A238448.
%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
|