OFFSET
1,1
COMMENTS
It is known that k always exists if q is congruent to +-1 mod 18.
For n >= 2, k^3 == (9 - 18*n - 7*(-1)^n)/2 (mod 3^n) if and only if k - a(n) is divisible by 3^(n-1). - Jinyuan Wang, Feb 13 2020
LINKS
Robert Israel, Table of n, a(n) for n = 1..2095
EXAMPLE
a(1) = 2 because the first number of the form +-1 (mod 18) is 1, and 2^3 + 1 = 9 = 3*3^1;
a(2) = 1 because the second number of the form +-1 (mod 18) is 17, and 1^3 + 17 = 18 = 2*3^2;
a(3) = 2 because the third number of the form +-1 (mod 18) is 19, and 2^3 + 19 = 27 = 3^3;
a(4)= 16 because the fourth number of the form +-1 (mod 18) is 35, and 16^3 + 35 = 4131 = 51*3^4.
MAPLE
f:= proc(n) local q, R, k;
if n::odd then q:= 9*n-8 else q:= 9*n-1 fi;
min(map(subs, [msolve(k^3+q, 3^n)], k))
end proc:
map(f, [$1..30]); # Robert Israel, Dec 23 2018
MATHEMATICA
lst1={1}; Do[lst1=Union[lst1, Union[{18*n+1}, {18*n-1}]], {n, 1, 10}]; lst={}; Do[k=1; While[Mod[k^3+lst1[[n]], 3^n]!=0, k++]; Print[n, " ", k], {n, 1, 10}]; lst
PROG
(PARI) a(n) = {if (n % 2, q = 9*(n-1)+1, q = 9*n-1); m = 3^n; k = 1; while ((k^3+q) % m, k++); k; } \\ Michel Marcus, Jan 07 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Dec 07 2014
STATUS
approved