close
login
A383066
A 2-regular sequence associated with the number of divisors of n^2 + 1 (A193432).
1
0, 1, 1, 2, 3, 3, 2, 3, 7, 8, 5, 5, 8, 7, 3, 4, 13, 17, 12, 13, 21, 18, 7, 7, 18, 21, 13, 12, 17, 13, 4, 5, 21, 30, 23, 27, 46, 41, 17, 18, 47, 55, 34, 31, 43, 32, 9, 9, 32, 43, 31, 34, 55, 47, 18, 17, 41, 46, 27, 23, 30, 21, 5, 6, 31, 47, 38, 47, 83, 76, 33
OFFSET
1,4
COMMENTS
Shakov proves that the number of occurrences of k in this sequence is equal to the number of divisors of k^2+1.
It is a 2-regular sequence.
LINKS
Anton Shakov, Polynomials in Z[x] whose divisors are enumerated by SL_2(N_0), arXiv:2405.03552 [math.NT], 2024.
Anton Shakov, A 2-Regular Sequence That Counts The Divisors of n^2+1, arXiv:2510.22805 [math.NT], 2025.
FORMULA
a(n) obeys the recurrences:
a(4*n) = 2*a(2*n) - a(n)
a(4*n+1) = 2*a(2*n) + a(2*n+1)
a(4*n+2) = 2*a(2*n+1) + a(2*n)
a(4*n+3) = 2*a(2*n+1) - a(n)
and a(1) = 0, a(2) = 1, a(3) = 1.
EXAMPLE
For example, 7 occurs at indices 9, 14, 23, 24, 128, 255, and there are 6 divisors of 7^2+1 = 50.
MAPLE
f:= proc(n) option remember; local m, k;
m:= n mod 4;
k:= (n-m)/4;
if m = 0 then 2*procname(2*k) - procname(k)
elif m = 1 then 2*procname(2*k) + procname(2*k+1)
elif m = 2 then 2*procname(2*k+1)+procname(2*k)
else 2*procname(2*k+1)-procname(k)
fi;
end proc:
f(1):= 0: f(2):= 1: f(3):= 1:
map(f, [$1..100]); # Robert Israel, Apr 15 2025
PROG
(Python)
from functools import cache
@cache
def a(n):
if n < 4: return int(n>1)
q, r = divmod(n, 4)
if r == 0: return 2*a(2*q) - a(q)
elif r == 1: return 2*a(2*q) + a(2*q+1)
elif r == 2: return 2*a(2*q+1) + a(2*q)
else: return 2*a(2*q+1) - a(q)
print([a(n) for n in range(1, 72)]) # Michael S. Branicky, Apr 15 2025
CROSSREFS
Cf. A193432.
Sequence in context: A089783 A302939 A090414 * A068227 A235343 A236456
KEYWORD
nonn,look
AUTHOR
Jeffrey Shallit, Apr 15 2025
STATUS
approved