OFFSET
0,3
COMMENTS
There are only two square stella octangula numbers, namely those corresponding to n = 1 and n = 169, so a(1) = 0 and a(169) = 0 (cf. Wikipedia link).
LINKS
MATHEMATICA
f[n_, i_: 1] := Block[{k = n, j = If[i == 1, 1, -1]}, While[Nor[k == 1, GCD @@ FactorInteger[k][[All, 2]] > 1], k = k + j]; k]; {1}~Join~Array[Min@ Abs@ {# - f[#], f[#, 0] - #} &[# (2 #^2 - 1)] &, 60] (* Michael De Vlieger, Feb 21 2018 *)
PROG
(PARI) a007588(n) = n*(2*n^2-1)
is_a001597(n) = ispower(n) || n==1
nearestpower(n) = my(x=0); while(1, if(x < n, if(is_a001597(n-x), return(n-x), if(is_a001597(n+x), return(n+x))), if(is_a001597(n+x), return(n+x))); x++)
a(n) = abs(a007588(n)-nearestpower(a007588(n)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Felix Fröhlich, Feb 07 2018
STATUS
approved