OFFSET
0,1
COMMENTS
a(n) is the smallest positive multiplicative inverse of 5 modulo 2^(4*n+3).
In binary, a(n) is written as 10011001...1001101 where "1001" appears n times. When n approaches infinity we get the 2-adic expansion of 1/5: ...10011001101. Similarly, the 2-adic expansion of 1/3 is ...101010101011.
LINKS
Jianing Song, Table of n, a(n) for n = 0..200
Index entries for linear recurrences with constant coefficients, signature (17,-16).
FORMULA
O.g.f.: (5 - 8*x)/((1 - x)*(1 - 16*x)).
E.g.f.: (24*exp(16*x) + exp(x))/5.
a(0) = 5, a(1) = 77; for n>1, a(n) = 17*a(n-1) - 16*a(n-2).
EXAMPLE
The smallest solution to 5*x == 1 (mod 8) is x = (3*2^3 + 1)/5 = 5.
The smallest solution to 5*x == 1 (mod 128) is x = (3*2^7 + 1)/5 = 77.
MATHEMATICA
Table[(3 2^(4 n + 3) + 1) / 5, {n, 0, 20}] (* Vincenzo Librandi, Aug 24 2018 *)
LinearRecurrence[{17, -16}, {5, 77}, 20] (* Harvey P. Dale, Sep 25 2020 *)
PROG
(PARI) a(n) = (3*2^(4*n + 3) + 1)/5
(Magma) [(3*2^(4*n + 3) + 1)/5: n in [0..20]]; // Vincenzo Librandi, Aug 24 2018
(Python)
def A318236(n): return (3*(1<<(n<<2)+3)+1)//5 # Chai Wah Wu, Jul 29 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jianing Song, Aug 21 2018
STATUS
approved