cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A178983 The smallest cube containing n as a substring.

This page as a plain text file.
%I A178983 #17 Nov 17 2024 13:07:48
%S A178983 0,1,27,343,64,125,64,27,8,729,1000,91125,125,1331,140608,15625,216,
%T A178983 1728,85184,2197,205379,216,226981,103823,13824,125,9261,27,1728,729,
%U A178983 39304,1331,5832,1331,343,35937,97336,3375,13824,39304,4096,531441,42875,343
%N A178983 The smallest cube containing n as a substring.
%H A178983 T. D. Noe, <a href="/A178983/b178983.txt">Table of n, a(n) for n = 0..1000</a>
%e A178983 a(3) = 7^3 = 343, because it contains 3 as a substring and no smaller cube contains 3.
%t A178983 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 *)
%t A178983 With[{cbs=Range[0,100]^3},Table[SelectFirst[cbs,SequenceCount[IntegerDigits[#],IntegerDigits[n]]>0&],{n,0,50}]] (* _Harvey P. Dale_, Nov 17 2024 *)
%o A178983 (Ruby)
%o A178983 # For a given nonnegative integer n,
%o A178983 # find the smallest nonnegative cube that contains it as a substring.
%o A178983 NUM_TERMS = 30
%o A178983 (0...NUM_TERMS).each{ |i|
%o A178983   (0..(1.0/0.0)).each{ |j|
%o A178983     (print "#{j*j*j}" + ", "; break) if "#{j*j*j}".include?("#{i}")
%o A178983   }
%o A178983 }
%Y A178983 Cf. A029943, A029947.
%K A178983 nonn,easy,base
%O A178983 0,3
%A A178983 _Andy Martin_, Jan 02 2011
%E A178983 Edited by _Alois P. Heinz_, Jan 02 2011