login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = the first positive integer, not ending in zero, whose cube has a substring of exactly n identical digits.
1

%I #16 Apr 10 2017 23:42:39

%S 1,11,126,753,1923,32183,134708,1487139,23908603,215443469,106917811,

%T 15056809703,27354803113,681048619195,361160395301

%N a(n) = the first positive integer, not ending in zero, whose cube has a substring of exactly n identical digits.

%e a(3) = 126, as 126^3 = 2000376 contains a digit (0) repeated n (3) times.

%t a[n_] := Block[{k=1}, While[Mod[k, 10] == 0 || ! MemberQ[Length /@ Split[ IntegerDigits[ k^3]], n], k++]; k]; Array[a, 8] (* _Giovanni Resta_, Apr 10 2017 *)

%o (Python) import collections

%o import re

%o cur = 1

%o def repeat( num , reps ):

%o r = str(num)

%o n = 1

%o while n < reps:

%o r += str(num)

%o n += 1

%o return r;

%o while True:

%o k = 0

%o while k < 10:

%o rep = repeat(k,9)

%o while re.search(rep, str(cur**3)) != None:

%o if re.search(rep + str(k), str(cur**3)) == None:

%o print(str(cur) + ", " + str(cur**3))

%o rep += str(k)

%o else:

%o rep += str(k)

%o k += 1

%o cur += 1

%o if cur % 10 == 0:

%o cur += 1 #note: this will display all cubes with a substring of 9 repeated digits. To change this to n repeats, replace repeat(k,9) with repeat(k,n).

%Y Cf. A167712.

%K nonn,base,more

%O 1,2

%A _Jason Wang_, Apr 08 2017

%E a(10)-a(15) from _Giovanni Resta_, Apr 10 2017