Hi all,
While exploring the multiplicative group (Z/nZ)*, I computed
a(n) = #{x : 1<=x<=n, gcd(x,n)=1, gcd(x+1,n)=1, ord_n(x) = ord_n(x+1)}
(a(1)=1 by convention). First terms:
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 4, 0, 1, 0, 1, 0, 5, 0, 6, 0, 1, 0, 8, 0, 3, 0, 0, 0, 9, 0, 6, 0
Two easy facts: a(n)=0 for all even n (parity forces one of x,x+1 to be
non-unit), and a(3^k)=0 for all k (the map to (Z/3Z)* forces x's order odd
and (x+1)'s order even). The top stratum ord(x)=ord(x+1)=phi(n) is exactly
the "consecutive primitive roots" problem (Carella, arXiv:2604.13090), which
has established literature — but I haven't found the aggregate count (over
all shared orders, not just the top one) treated anywhere. Closest related
work I found is Chang (arXiv:1210.6429) on max{ord(x),ord(x+1)}, which
bounds the maximum rather than counting equal-order pairs.
I searched the full OEIS data dump (oeis/oeisdata mirror, ~397k sequences,
exact substring match on 200 computed terms) and found no match. Checked my
search method against known sequences (A046144, A002997, A001918) to
confirm it retrieves what it should — it does.
Does this ring a bell for anyone, or look OEIS-worthy? b-file (200 terms)
and Python code attached/below. Happy to be told it's already known under a
different guise — that's useful too.
Thanks,
Donovan Sneider
from math import gcd
def multiplicative_order(a, n):
"""Multiplicative order of a mod n, or None if a is not a unit."""
a %= n
if gcd(a, n) != 1:
return None
x, k = a, 1
while x != 1:
x = (x * a) % n
k += 1
if k > n:
return None
return k
def a(n):
"""a(n) = #{x in U(n) : x+1 in U(n), ord(x) = ord(x+1)}, a(1)=1."""
if n == 1:
return 1
total = 0
for x in range(1, n):
if gcd(x, n) == 1:
y = (x + 1) % n
if gcd(y, n) == 1:
if multiplicative_order(x, n) == multiplicative_order(y, n):
total += 1
return total
# example: first 40 terms
print([a(n) for n in range(1, 41)])