cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

User: Luke Palmer

Luke Palmer's wiki page.

Luke Palmer has authored 1 sequences.

A276125 a(n) = maximum eventual period of z := z^2 + c (mod n), for Gaussian integers z, c.

Original entry on oeis.org

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

Author

Luke Palmer, Aug 21 2016

Keywords

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)

Examples

			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.
		

Programs

  • 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 *)

Extensions

More terms from Robert Israel, Aug 29 2016