OFFSET
0,2
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 (2,0,1,-2).
FORMULA
a(n) = ceiling(2^(n+2)/7) [Finch-Sebah, page 12]. - N. J. A. Sloane, Sep 30 2018
G.f.: (-2*x^3-x^2+1)/((1-2*x)*(1-x^3)).
a(n) = 1 + A033138(n) for n >= 1. - John Keith, Mar 07 2022
EXAMPLE
For n=3, the cubes 0^3, 1^3, 2^3, ..., 7^3 reduced mod 2^3 = 8 are 0,1,0,3,0,5,0,7, five different values, so a(3)=5. - N. J. A. Sloane, Sep 30 2018
MAPLE
A049347 := proc(n) op( (n mod 3)+1, [1, -1, 0]) ; end proc:
A046630 := proc(n) 2^(n+2)/7+2/3-(5*A049347(n)+A049347(n-1))/21 ; end proc: # R. J. Mathar, Feb 27 2011
MATHEMATICA
LinearRecurrence[{2, 0, 1, -2}, {1, 2, 3, 5}, 33] (* Jean-François Alcover, Nov 17 2017 *)
PROG
(PARI) a(n)=(4<<n+6)\7 \\ Charles R Greathouse IV, Jan 03 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved