login
Smallest number m such that 3^m contains a string of n consecutive increasing integers in its decimal representation.
1

%I #10 Mar 06 2014 14:21:40

%S 0,8,20,57,332,332,6814,7926,16724,200633

%N Smallest number m such that 3^m contains a string of n consecutive increasing integers in its decimal representation.

%e 8 is the smallest exponent such that 3^8 contains two consecutive increasing integers (3^8 = 6561).

%e 20 is the smallest exponent such that 3^20 contains three consecutive increasing integers (3^20 = 3486784401).

%o (Python)

%o def StrInc(x):

%o ..for n in range(10**5):

%o ....count = 0

%o ....i = 0

%o ....string = str(3**n)

%o ....if len(string) == x and x == 1:

%o ......return n

%o ....while i < len(string)-1:

%o ......if int(string[i]) == int(string[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 < 15:

%o ..print(StrInc(x))

%o ..x += 1

%Y Cf. A238448, A215727.

%K nonn,base,fini,full

%O 1,2

%A _Derek Orr_, Feb 27 2014

%E a(8)-a(10) from _Giovanni Resta_, Mar 02 2014