A226785 If n=0 (mod 7) then a(n)=0, otherwise a(n)=7^(-1) in Z/nZ*.
0, 1, 1, 3, 3, 1, 0, 7, 4, 3, 8, 7, 2, 0, 13, 7, 5, 13, 11, 3, 0, 19, 10, 7, 18, 15, 4, 0, 25, 13, 9, 23, 19, 5, 0, 31, 16, 11, 28, 23, 6, 0, 37, 19, 13, 33, 27, 7, 0, 43, 22, 15, 38, 31, 8, 0, 49, 25, 17, 43, 35, 9, 0
Offset: 1
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
- Index entries for linear recurrences with constant coefficients, signature (0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, -1).
Programs
-
Maple
A226785 := proc(n) local x,a,m ; a := 7 ; m := 7 ; if igcd(n,m) > 1 or n =1 then 0; else msolve(x*a=1,n) ; op(%) ; op(2,%) ; end if; end proc: # R. J. Mathar, Jun 28 2013
-
Mathematica
Inv[a_, mod_] := Which[mod == 1,0, GCD[a, mod] > 1, 0, True, Last@Reduce[a*x == 1, x, Modulus -> mod]];Table[Inv[7, n],{n, 1, 122}] Join[{0},LinearRecurrence[{0,0,0,0,0,0,2,0,0,0,0,0,0,-1},{1,1,3,3,1,0,7,4,3,8,7,2,0,13},70]] (* Harvey P. Dale, Nov 15 2014 *) Table[If[Mod[n, 7]==0, 0, ModularInverse[7, n]], {n, 1, 100}] (* Jean-François Alcover, Mar 14 2023 *)
-
PARI
a(n)=if(n%7,lift(Mod(1,n)/7),0) \\ Charles R Greathouse IV, Jun 18 2013
Formula
G.f.: -x^2*(x^13 -x^10 -2*x^9 -x^8 -2*x^7 -7*x^6 -x^4 -3*x^3 -3*x^2 -x -1) / (x^14 -2*x^7 +1). a(n) = 2*a(n-7)-a(n-14). - Colin Barker, Jun 20 2013
a(7n+1) = 6*n+1, n>0. a(7n+2)=A016777(n). a(7n+3) = A005408(n). a(7n+4) = A016885(n). a(7n+5)= A004767(n). a(7n+6)= n+1. - R. J. Mathar, Jun 28 2013