A046631 Number of cubic residues mod 3^n.
1, 3, 3, 7, 21, 57, 169, 507, 1515, 4543, 13629, 40881, 122641, 367923, 1103763, 3311287, 9933861, 29801577, 89404729, 268214187, 804642555, 2413927663, 7241782989, 21725348961, 65176046881, 195528140643, 586584421923
Offset: 0
Links
- S. R. Finch and Pascal Sebah, Squares and Cubes Modulo n, arXiv:math/0604465 [math.NT], 2006-2016.
- Index entries for linear recurrences with constant coefficients, signature (3,0,1,-3).
Programs
-
Maple
A049347 := proc(n) op( (n mod 3)+1,[1,-1,0]) ; end proc: A046631 := proc(n) 3^(n+1)/13+4/3-(22*A049347(n)-16*A049347(n-1))/39 ; end proc: # R. J. Mathar, Feb 27 2011
-
Mathematica
LinearRecurrence[{3, 0, 1, -3}, {1, 3, 3, 7}, 27] (* Jean-François Alcover, Nov 22 2017 *)
Formula
G.f.: (-3*x^3-6*x^2+1)/((1-3*x)*(1-x^3)).
a(n) = A046530(3^n) = 4/3 + 3^(n+1)/13 - (22*A049347(n) - 16*A049347(n-1))/39. - R. J. Mathar, Feb 27 2011