OFFSET
1,1
COMMENTS
a(n) = 0 if and only if n is in A246449.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
512 is the smallest cube ending with digit 2, so a(2) = 51.
PROG
(PARI)
b(n)=v=[]; for(k=10^(n-1), 10^n, v=concat(v, k^3%10^n)); v=vecsort(v, , 8); v
w=[]; for(k=1, 250, d=digits(k); if(vecsearch(b(#d), k), w=concat(w, k))); w=vecsort(w, , 8); w;
a(n)=if(!vecsearch(w, n), return(0)); if(vecsearch(w, n), j=1; s=Str(n); while(!ispower(eval(concat(Str(j), s)), 3), j++); return(j))
vector(200, n, a(n))
(Python)
from sympy import nthroot_mod
def A246561(n): return 0 if len(l:=nthroot_mod(n, 3, (m:=10**(len(str(n)))))) == 0 else int((min(x for x in l+[d+m for d in l] if x**3>=m)**3-n)//m) # Chai Wah Wu, Feb 16 2023
CROSSREFS
KEYWORD
AUTHOR
Derek Orr, Aug 29 2014
EXTENSIONS
a(27), a(29) and a(43) corrected by Chai Wah Wu, Feb 16 2023
STATUS
approved