OFFSET
1,2
COMMENTS
Records occur at n = 1, 2, 4, 6, 12, 24, 30, 48, 60, 120, 210, 240, 360, 420, 840, 1680, 2520, 4620, 6720, 9240, ... - Antti Karttunen, Nov 13 2018
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
EXAMPLE
For n=3 we have to take into consideration the set Z3=[0,1,2], integers modulo 3, multiplying Z3 by itself. So we have these outcomes: 0 (0*0), 0 (0*1), 0 (0*2), 0 (1*0), 1 (1*1), 2 (1*2), 0 (2*0), 2 (2*1) and 1 (2*2 mod 3). Frequency of outcome 0 is 5, of 1 is 2 and of 2 is 2. Different frequencies are only 5 and 2, for a total of two. So a(3)=2.
MATHEMATICA
a[n_] := Length@ Union[Last /@ Tally@ Mod[ Times @@@ Tuples[Range@ n, 2], n]]; Array[a, 69] (* Giovanni Resta, Sep 03 2018 *)
PROG
(Python)
fine=70
zc = []
ris=""
def nclass(v):
n=0
l=[]
for item in v:
if item not in l:
l.append(item)
n+=1
return n
for z in range(1, fine):
for k in range(z): zc.append(0)
for i in range(z):
for j in range(z):
r=(i*j)%z
zc[r]+=1
ris = ris + ", " + str(nclass(zc))
zc = []
print(ris)
(PARI) A318412(n) = { my(m=Map(), fs=List([])); for(i=0, n-1, for(j=0, n-1, my(r=(i*j)%n, p = if(mapisdefined(m, r), mapget(m, r), 0)); mapput(m, r, p+1))); for(i=0, n-1, listput(fs, mapget(m, i))); #Set(fs); }; \\ Antti Karttunen, Nov 09 2018
(PARI) A318412(n) = { my(fs=vector(n)); fs[1+0] = (n+n-1+(0==(n%4))); if(2==(n%4), fs[1+(((n/2)^2)%n)] = 1); for(i=1, n\2, for(j=1, (n-1)\2, fs[1+((i*j)%n)] += 2; fs[1+((i*(n-j))%n)] += 2)); #Set(fs); }; \\ Antti Karttunen, Nov 10 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierandrea Formusa, Sep 01 2018
EXTENSIONS
More terms from Antti Karttunen, Nov 09 2018
STATUS
approved