login
Smallest number whose cube begins and ends in n, or 0 if no such number exists.
2

%I #9 Nov 19 2019 16:35:45

%S 0,1,28,7,74,175,86,43,2,99,0,2271,108,517,0,0,256,2573,0,1239,0,

%T 12841,0,2847,624,1365,0,3,1412,309,0,6811,318,6977,0,0,1546,3333,0,

%U 1579,0,7481,0,3507,164,0,0,363,7872,17049,0,17251,8078,8137,0,0,1786,1793,0

%N Smallest number whose cube begins and ends in n, or 0 if no such number exists.

%H Robert Israel, <a href="/A077752/b077752.txt">Table of n, a(n) for n = 0..10000</a>

%p f:= proc(n) local S, Sa, k, m, x, a;

%p m:= 1 + ilog10(n);

%p S:= map(t -> subs(t, x), [msolve(x^3=n, 10^m)]);

%p if S = [] then return 0 fi;

%p for k from 0 do

%p a:= ceil((n*10^k)^(1/3));

%p Sa:= map(s -> (s-a) mod 10^m, S);

%p x:= a + min(Sa);

%p if x^3 < (n+1)*10^k then return x fi;

%p od

%p end proc:

%p f(0):= 0:

%p map(f, [$0..100]);# _Robert Israel_, Nov 19 2019

%Y a(n) = A077751(n)^(1/3).

%K base,nonn,look

%O 0,3

%A _Amarnath Murthy_, Nov 20 2002

%E More terms from _Sascha Kurz_, Jan 07 2003