login
A113757
Cardinality of a maximal subset S of {0,1,...,n-1} that does not contain x+y (mod n) or x*y (mod n) for x,y in S.
1
0, 0, 1, 1, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4, 6, 4, 4, 6, 4, 8, 7, 8, 6, 8, 10, 8, 9, 8, 8, 12, 8, 10, 12, 8, 11, 11, 10, 8, 12, 10, 10, 12, 10, 11, 11, 12, 10, 12, 14, 10, 11, 13, 12, 16, 11, 16, 11, 12, 12, 15, 14, 12, 18, 20, 12, 12, 12, 17, 16, 18, 12, 18
OFFSET
1,5
EXAMPLE
a(5)=2 since, (a) taking S={2,3} we have that 2+2=4,2+3=0,3+3=1,2*2=4,2*3=1,3*3=4 and 0,1,4 do not belong to S; (b) there is not a similar subset S with 3 elements, so S is maximal.
MATHEMATICA
comb[n_, s_] := Union[Mod[Flatten@ Table[{s[[i]] + s[[j]], s[[i]] s[[j]]}, {i, Length[s]}, {j, i}], n]]; ric[n_, f_, s_] := Block[{}, If[Length@s > Length@mx, mx = s]; Do[ If[Intersection[Join[s, {i}], comb[n, Join[s, {i}]]] == {}, ric[n, i, Append[s, i]]], {i, f+1, n-1}]]; a[n_] := (mx = {}; ric[n, 1, {}]; Length@mx); Array[a, 24]
CROSSREFS
Sequence in context: A171482 A132015 A120501 * A291270 A291267 A261221
KEYWORD
hard,nonn
AUTHOR
Giovanni Resta, Jan 17 2006
EXTENSIONS
Extended by Giovanni Resta, Apr 03 2014
STATUS
approved