OFFSET
0,3
LINKS
T. D. Noe, Table of n, a(n) for n = 0..1000
EXAMPLE
a(3) = 7^3 = 343, because it contains 3 as a substring and no smaller cube contains 3.
MATHEMATICA
subs[n_] := Module[{d = IntegerDigits[n], len}, len = Length[d]; Union[Flatten[Table[FromDigits[Take[d, {i, k}]], {k, len}, {i, k}]]]]; Table[k = 0; While[! MemberQ[subs[k^3], n], k++]; k^3, {n, 0, 100}] (* T. D. Noe, Nov 06 2013 *)
With[{cbs=Range[0, 100]^3}, Table[SelectFirst[cbs, SequenceCount[IntegerDigits[#], IntegerDigits[n]]>0&], {n, 0, 50}]] (* Harvey P. Dale, Nov 17 2024 *)
PROG
(Ruby)
# For a given nonnegative integer n,
# find the smallest nonnegative cube that contains it as a substring.
NUM_TERMS = 30
(0...NUM_TERMS).each{ |i|
(0..(1.0/0.0)).each{ |j|
(print "#{j*j*j}" + ", "; break) if "#{j*j*j}".include?("#{i}")
}
}
CROSSREFS
KEYWORD
nonn,easy,base,changed
AUTHOR
Andy Martin, Jan 02 2011
EXTENSIONS
Edited by Alois P. Heinz, Jan 02 2011
STATUS
approved