A066451 a(n) is the number of integers k > 0 such that (n*k+1)/(k^2+1) is an integer.
1, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 2, 3, 1, 2, 1, 3, 1, 2, 1, 3, 2, 3, 1, 2, 1, 3, 1, 2, 1, 3, 2, 3, 1, 2, 1, 3, 2, 2, 1, 2, 2, 4, 1, 2, 1, 3, 1, 2, 1, 2, 2, 3, 1, 3, 1, 5, 1, 2, 1, 2, 2, 3, 1, 2, 1, 3, 1, 2, 1, 2, 3, 4, 1, 2, 1, 3, 1, 2, 2, 2, 2, 4, 1, 2, 1, 3, 1, 3, 1, 3, 2, 3, 1, 2, 1, 3, 1, 2, 1, 2, 2, 3, 1, 2
Offset: 1
Keywords
Examples
a(57)=5 because (57*k+1)/(k^2+1) is an integer for k = 1,2,5,7,57.
Programs
-
Mathematica
a[n_]:=Sum[Boole[Denominator[(n*k+1)/(k^2+1)]==1],{k,n}]; Array[a,105] (* Stefano Spezia, Aug 22 2025 *)
-
PARI
a(n) = sum(k=1, n, denominator((n*k+1)/(k^2+1)) == 1); \\ Michel Marcus, Feb 17 2021