OFFSET
1,2
COMMENTS
Each multiple of 9 is in the sequence. Additionally, the squares are also present.
REFERENCES
M. Fujiwara and Y. Ogawa, Introduction to Truly Beautiful Mathematics. Tokyo: Chikuma Shobo, 2005.
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,1,-1).
FORMULA
G.f.: x*(x+1)*(x^7+3*x^5+x^3+x^2+2*x+1)/((1-x)^2*(1+x^3+x^6)*(1+x+x^2)). - Alois P. Heinz, Feb 08 2023
a(n) = 2*(n+1) - b(n) where b(n>=0) = 2,3,2,1,1,2,1,0,1,2,3,2,... has period 9. - Kevin Ryde, Mar 26 2023
EXAMPLE
4 is a term since 4^4 = 256 == 4 (mod 9).
MAPLE
A358348 := proc(n)
2*(n+1)-op(modp(n, 9)+1, [2, 3, 2, 1, 1, 2, 1, 0, 1]) ;
end proc:
seq(A358348(n), n=1..50) ; # R. J. Mathar, Mar 29 2023
MATHEMATICA
Select[Range[130], MemberQ[{0, 1, 4, 7, 9, 10, 13, 16, 17}, Mod[#, 18]] &] (* Amiram Eldar, Nov 12 2022 *)
PROG
(PARI) isok(k) = k == Mod(k, 9)^k; \\ Michel Marcus, Nov 22 2022
(Python)
def A358348(n):
return ((0, 1, 4, 7, 9, 10, 13, 16, 17)[m := n % 9]
+ (n - m << 1)) # Chai Wah Wu, Feb 09 2023
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Ivan Stoykov, Nov 11 2022
STATUS
approved