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.

A318412 Number of different frequencies of values in the set { i*j mod n: 0 <= i, j <= n-1 }.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Pierandrea Formusa, Sep 01 2018

Keywords

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

Examples

			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.
		

Crossrefs

Cf. A285052.

Programs

  • Mathematica
    a[n_] := Length@ Union[Last /@ Tally@ Mod[ Times @@@ Tuples[Range@ n, 2], n]]; Array[a, 69] (* Giovanni Resta, Sep 03 2018 *)
  • 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
  • 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)
    

Extensions

More terms from Antti Karttunen, Nov 09 2018