OFFSET
1,1
EXAMPLE
{4} is one of the a(6) = 27 idempotent (mod 6) subsets of {0,1,2,3,4,5}, since {4}*{4} = {16 mod 6} = {4}.
PROG
(Python)
from itertools import chain, combinations
def powerset(s):
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
def cond(s, n):
return set(s)==set((si*sj)%n for i, si in enumerate(s) for sj in s[i:])
def a(n):
return sum(1 for s in powerset(range(n)) if cond(s, n))
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Feb 01 2022
(PARI) idemp(s, n) = {my(ss = setbinop((x, y)->x*y % n, s), j); if ((j=setsearch(ss, 0)), ss[j] = n; ss = Set(ss)); s == ss; }
a(n) = {my(nb=0); forsubset(n, s, if (idemp(Vec(s), n), nb++); ); nb; } \\ Michel Marcus, Feb 01 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
John W. Layman, Sep 26 2003
EXTENSIONS
a(26)-a(31) from Michael S. Branicky, Feb 01 2022
STATUS
approved