OFFSET
1,1
COMMENTS
Equivalently, numbers k such that k and (7^h)^k end with the same digit, where h == 1 (mod 4).
Also, numbers k such that k and (3^h)^k end with the same digit, where h == 3 (mod 4).
Numbers congruent to {3, 17} mod 20. - Amiram Eldar, Feb 27 2023
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
FORMULA
O.g.f.: x*(3 + 14*x + 3*x^2)/((1 + x)*(1 - x)^2).
E.g.f.: 3 + 2*exp(-x) + 5*(2*x - 1)*exp(x).
a(n) = -a(-n+1) = a(n-1) + a(n-2) - a(n-3).
a(n) = 10*n + 2*(-1)^n - 5. Therefore:
a(n) = 10*n - 7 for odd n;
a(n) = 10*n - 3 for even n.
a(n+2*k) = a(n) + 20*k.
Sum_{n>=1} (-1)^(n+1)/a(n) = tan(7*Pi/20)*Pi/20. - Amiram Eldar, Feb 27 2023
MAPLE
select(n->n^n mod 10=7, [$1..563]); # Paolo P. Lava, Dec 18 2018
MATHEMATICA
Table[10 n + 2 (-1)^n - 5, {n, 1, 60}]
LinearRecurrence[{1, 1, -1}, {3, 17, 23}, 80] (* Harvey P. Dale, Sep 15 2019 *)
PROG
(Sage) [10*n+2*(-1)^n-5 for n in (1..70)]
(Maxima) makelist(10*n+2*(-1)^n-5, n, 1, 70);
(GAP) List([1..70], n -> 10*n+2*(-1)^n-5);
(Magma) [10*n+2*(-1)^n-5: n in [1..70]];
(Python) [10*n+2*(-1)**n-5 for n in range(1, 70)]
(Julia) [10*n+2*(-1)^n-5 for n in 1:70] |> println
(PARI) apply(A322490(n)=10*n+2*(-1)^n-5, [1..70])
(PARI) Vec(x*(3 + 14*x + 3*x^2) / ((1 + x)*(1 - x)^2) + O(x^55)) \\ Colin Barker, Dec 13 2018
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Bruno Berselli, Dec 12 2018
STATUS
approved