%I #42 Dec 21 2022 08:19:09
%S 1,2,2,3,2,4,2,4,3,4,2,6,2,4,4,5,2,6,2,6,4,4,2,7,3,4,4,6,2,8,2,6,4,4,
%T 4,7,2,4,4,8,2,8,2,6,6,4,2,10,3,6,4,6,2,7,4,8,4,4,2,12,2,4,6,7,4,8,2,
%U 6,4,8,2,11,2,4,6,6,4,8,2,10,5,4,2,12,4,4,4,8,2,12,4,6,4,4,4,11,2,6,6,7,2,8,2,8,8
%N Number of different frequencies of values in the set { i*j mod n: 0 <= i, j <= n-1 }.
%C 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
%H Antti Karttunen, <a href="/A318412/b318412.txt">Table of n, a(n) for n = 1..16384</a>
%e 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.
%t a[n_] := Length@ Union[Last /@ Tally@ Mod[ Times @@@ Tuples[Range@ n, 2], n]]; Array[a, 69] (* _Giovanni Resta_, Sep 03 2018 *)
%o (Python)
%o fine=70
%o zc = []
%o ris=""
%o def nclass(v):
%o n=0
%o l=[]
%o for item in v:
%o if item not in l:
%o l.append(item)
%o n+=1
%o return n
%o for z in range(1,fine):
%o for k in range(z): zc.append(0)
%o for i in range(z):
%o for j in range(z):
%o r=(i*j)%z
%o zc[r]+=1
%o ris = ris + "," + str(nclass(zc))
%o zc = []
%o print(ris)
%o (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
%o (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
%Y Cf. A285052.
%K nonn
%O 1,2
%A _Pierandrea Formusa_, Sep 01 2018
%E More terms from _Antti Karttunen_, Nov 09 2018