login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A276125
a(n) = maximum eventual period of z := z^2 + c (mod n), for Gaussian integers z, c.
0
1, 2, 3, 2, 6, 6, 12, 2, 24, 6, 30, 6, 30, 22, 6, 2, 30, 24, 90, 6, 33, 42, 59, 6, 40, 30, 72, 22, 77, 6, 73, 2, 66, 30, 66, 24, 72, 90, 60, 6, 99, 66, 122, 42, 48, 118, 144, 6, 432, 40, 60, 30, 132, 72, 66, 22, 129, 154, 870, 6, 210, 146, 264, 2, 60, 66, 224, 30
OFFSET
1,2
COMMENTS
Note that this is the maximum over all possible initial z.
From Robert Israel, Aug 29 2016: (Start)
If n is divisible by 4, then a(n) = a(n/2).
In particular, a(n) = 2 if n > 1 is a power of 2.
Are there any other n with a(n) = 2? (End)
EXAMPLE
For n = 3, c = 2+i:
z_0 = 0.
z_1 = (z_0)^2 + 2+i = 2+ i (mod 3).
z_2 = (z_1)^2 + 2+i = 2+2i (mod 3).
z_3 = (z_2)^2 + 2+i = 2 (mod 3).
z_4 = (z_3)^2 + 2+i = i (mod 3).
z_5 = (z_4)^2 + 2+i = 1+ i (mod 3).
z_6 = (z_5)^2 + 2+i = 2 (mod 3) = z_3.
So the eventual period is 3, which is the maximum possible over all c and z_0 when n = 3.
MAPLE
f:= proc(N)
local pmax, R, S, T, z, a, b, c, x, y, found, zpd, count;
pmax:= 0;
for a from 0 to N-1 do
for b from 0 to N-1 do
c:= a+b*I;
S:= {}:
for x from 0 to N-1 do
for y from 0 to N-1 do
z:= x+I*y;
if not member(z, S) then
T:= {z};
R[z]:= 0;
found:= false;
for count from 1 do
z:= expand(z^2 + c) mod N;
if member(z, S) then break fi;
if member(z, T) then found:= true; zpd:= count - R[z]; break fi;
R[z]:= count;
T:= T union {z};
od;
S:= S union T;
if found and zpd > pmax then
pmax:= zpd fi;
fi;
od od;
od od;
pmax
end proc:
map(f, [$1..30]); # Robert Israel, Aug 29 2016
MATHEMATICA
f[n_] := Module[{pmax = 0, R, S, T, z, a, b, c, x, y, found, zpd, count},
For[a = 0, a <= n - 1, a++,
For[b = 0, b <= n - 1, b++, c = a + b*I; S = {};
For[x = 0, x <= n - 1, x++,
For[y = 0, y <= n - 1, y++, z = x + y*I;
If[!MemberQ[S, z], T = {z}; R[z] = 0; found = False;
For[count = 1, True, count++,
z = Mod[Expand[z^2 + c], n];
If[MemberQ[S, z], Break[] ];
If [MemberQ[T, z], found = True; zpd = count -
R[z]; Break[]]; R[z] = count;
T = Union[T, {z}]]; S = Union[S, T];
If [found && zpd > pmax, pmax = zpd]]]]]];
pmax];
Table[f[n], {n, 1, 20}] (* Jean-François Alcover, May 12 2023, after Robert Israel *)
CROSSREFS
Sequence in context: A005421 A348083 A306156 * A208611 A209582 A158279
KEYWORD
nonn
AUTHOR
Luke Palmer, Aug 21 2016
EXTENSIONS
More terms from Robert Israel, Aug 29 2016
STATUS
approved