New sequence? Consecutive units with equal multiplicative order mod n

23 views
Skip to first unread message

Snieder may

unread,
Jul 7, 2026, 8:01:54 PM (6 days ago) Jul 7
to seq...@googlegroups.com
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)])

E1 bfile n1 200.pdf

Sean A. Irvine

unread,
Jul 8, 2026, 12:05:19 AM (6 days ago) Jul 8
to seq...@googlegroups.com
Hi Donvan,

Where we have a situation like all even terms are 0, the OEIS typically omits those terms and would instead give only the terms of odd indices.

But trying that I did not find your sequence, nor did I find the subsequence of prime indices.

I think you should go ahead and submit it (at odd indices), the editors will decide if it is worthy :-)

Sean.


--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/seqfan/CAFf%2BADBcQLS%2BAa0wDbJ3Ra%2BMgSRR_o1O-%3DU2YAJbv8bt_m5jeg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages