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.

Showing 1-5 of 5 results.

A007897 a(n) is multiplicative with a(2) = 1; a(4) = 2; a(2^i) = 2^(i-2)+2 if i>2; a(p^i) = 1+(p-1)*p^(i-1)/2 if prime p>2 and i>0.

Original entry on oeis.org

1, 1, 2, 2, 3, 2, 4, 4, 4, 3, 6, 4, 7, 4, 6, 6, 9, 4, 10, 6, 8, 6, 12, 8, 11, 7, 10, 8, 15, 6, 16, 10, 12, 9, 12, 8, 19, 10, 14, 12, 21, 8, 22, 12, 12, 12, 24, 12, 22, 11, 18, 14, 27, 10, 18, 16, 20, 15, 30, 12, 31, 16, 16, 18, 21, 12, 34, 18, 24, 12, 36, 16, 37, 19, 22, 20, 24, 14, 40, 18, 28
Offset: 1

Views

Author

Felix Weinstein (wain(AT)ana.unibe.ch), Dec 11 1999

Keywords

Comments

From Jeffrey Shallit, Jun 14 2018: (Start)
Except for first term, the same as A180783.
Equal to the number of elements x relatively prime to n such that x mod n >= x^(-1) mod n. (End)

Examples

			G.f. = x + x^2 + 2*x^3 + 2*x^4 + 3*x^5 + 2*x^6 + 4*x^7 + 4*x^8 + 4*x^9 + ...
		

References

  • Felix Weinstein, The Fibonacci Partitions, preprint, 1995.

Crossrefs

Programs

  • Mathematica
    a[ n_] := If[ n < 2, Boole[ n == 1],Times @@ Apply[ Function[ {p, e}, If[p == 2, If[e < 3, e, 2^(e - 2) + 2], 1 + p^(e - 1) (p - 1)/2]], FactorInteger @ n, 1]]; (* Michael Somos, May 26 2014 *)
  • PARI
    ap(p, e) = if (p==2, if (e==1, 1, if (e==2, 2, 2^(e-2)+2)), 1+(p-1)*p^(e-1)/2);
    a(n) = { my(f = factor(n)); prod(i=1, #f~, ap(f[i,1], f[i, 2]));} \\ Michel Marcus, Apr 19 2014
    
  • PARI
    {a(n) = my(A, p, e); if( n<1, 0, A = factor(n); prod( k=1, matsize(A)[1], if( p = A[k,1], e = A[k,2]; if( p==2, if( e<3, e, 2^(e-2) + 2), 1 + p^(e-1) * (p-1) / 2))))}; /* Michael Somos, May 26 2014 */
    
  • PARI
    {a(n) = if( n<1, 0, direuler( p = 2, n, if( p>2, 1 / (1 - X) + (p - 1) / 2 * X / (1 - p*X), (1 + X^2) / (1 - X) + p * X^3 / (1 - p*X))) [n])}; /* Michael Somos, May 26 2014 */

Formula

Dirichlet g.f.: zeta(s) * zeta(s-1) * ((2 - 2^(s+2) + 2^(2*s+1) - 1/2^(2*s-2))/(2^(2*s+1) - 3*2^s - 1)) * Product_{p prime} (1 - (1/p^(s-1) + 1/p^s - 1/p^(2*s-1) + 1/p^(2*s))/2). - Amiram Eldar, Nov 09 2023

Extensions

Definition corrected by Michel Marcus, Apr 19 2014
Changed name from phi(n) (which caused much confusion with the Euler phi-function) to a(n). - N. J. A. Sloane, May 26 2014

A376296 The number of solutions x<=y<=z<=w in Z/(n) of the equation x+y+z+w = x*y*z*w.

Original entry on oeis.org

1, 2, 6, 7, 14, 18, 27, 34, 51, 59, 91, 96, 134, 136, 208, 203, 285, 261, 385, 373, 493, 487, 650, 616, 818, 750, 949, 947, 1240, 1146, 1517, 1397, 1766, 1662, 2089, 1824, 2443, 2309, 2723, 2638, 3311, 2977, 3801, 3482, 4024, 3962, 4900, 4382, 5525, 5023, 6078
Offset: 1

Views

Author

W. Edwin Clark, Sep 19 2024

Keywords

Crossrefs

Programs

  • Maple
    a:=proc(n)
    local x,y,z,w,N;
    N:=0:
    for x from 0 to n-1 do
     for y from x to n-1 do
      for z from y to n-1 do
       for w from z to n-1 do
        if (x+y+z+w-x*y*z*w) mod n = 0 then N:=N + 1; fi;
       od:
      od:
     od:
    od:
    N;
    end:
  • Python
    def A376296(n):
        c = 0
        for x in range(n):
            for y in range(x,n):
                xy,xyp = x*y%n,(x+y)%n
                for z in range(y,n):
                    xyz, xyzp = xy*z%n-1,(xyp+z)%n
                    c += sum(not (xyz*w-xyzp)%n for w in range(z,n))
        return c # Chai Wah Wu, Sep 19 2024

A376427 The number of distinct values of x+y+z+w (mod n) when x*y*z*w = 1 (mod n).

Original entry on oeis.org

1, 1, 3, 1, 5, 3, 7, 2, 5, 5, 11, 3, 13, 7, 15, 4, 17, 5, 19, 5, 21, 11, 23, 6, 25, 13, 15, 7, 29, 15, 31, 8, 33, 17, 35, 5, 37, 19, 39, 10, 41, 21, 43, 11, 25, 23, 47, 12, 49, 25, 51, 13, 53, 15, 55, 14, 57, 29, 59, 15, 61, 31, 35, 16, 65, 33, 67, 17, 69, 35, 71, 10, 73, 37, 75, 19, 77, 39, 79, 20, 45, 41, 83, 21, 85, 43, 87, 22, 89, 25
Offset: 1

Views

Author

W. Edwin Clark, Sep 22 2024

Keywords

Comments

The values of n for which a(n) = n seem to agree with A325128. But I have no proof.

Crossrefs

Programs

  • Maple
    a:=proc(n)
    local x,y,z,w,N;
    N:={};
    for x from 0 to n-1 do
     for y from x to n-1 do
      for z from y to n-1 do
       for w from z to n-1 do
         if (x*y*z*w) mod n = 1 mod n then N:=N union {(x+y+z+w) mod n}; fi;
       od:
      od:
     od:
    od:
    nops(N);
    end:
  • Python
    def A376427(n):
        s = set()
        for x in range(n):
            for y in range(x,n):
                xy, xyp = x*y%n, (x+y)%n
                for z in range(y,n):
                    try:
                        s.add((xyp+z+pow(xy*z%n,-1,n))%n)
                    except:
                        continue
        return len(s) # Chai Wah Wu, Sep 23 2024

A197928 Number of pairs of integers i,j with 1<=i<=n, 1<=j<=i, such that i^2-j^2 = i*j (mod n).

Original entry on oeis.org

1, 1, 1, 3, 3, 1, 1, 3, 6, 3, 11, 3, 1, 1, 3, 10, 1, 6, 19, 11, 1, 11, 1, 3, 15, 1, 6, 3, 29, 3, 31, 10, 11, 1, 3, 21, 1, 19, 1, 11, 41, 1, 1, 43, 24, 1, 1, 10, 28, 15, 1, 3, 1, 6, 53, 3, 19, 29, 59, 11, 61, 31, 6, 36, 3, 11, 1, 3, 1, 3, 71, 21, 1, 1, 15, 75, 11, 1, 79, 42, 45, 41, 1, 3, 3, 1, 29, 43, 89, 24, 1, 3, 31, 1, 93, 10, 1, 28, 96, 55, 101, 1, 1, 3, 3
Offset: 1

Views

Author

John W. Layman, Oct 19 2011

Keywords

Comments

It appears that, except for the first term, a(n)=n if and only if n is a prime congruent to 1 or 4 (mod 5).

Crossrefs

Cf. A180783.

Programs

  • Maple
    a:= n-> add(add(`if`(irem((i-j)*(i+j)-i*j, n)=0, 1, 0), j=1..i), i=1..n):
    seq(a(n), n=1..100);  # Alois P. Heinz, Oct 19 2011

A376318 The number of distinct values of x+y+z (mod n) when x*y*z = 1 (mod n).

Original entry on oeis.org

1, 1, 2, 1, 4, 2, 7, 2, 4, 4, 11, 2, 13, 7, 8, 3, 17, 4, 19, 4, 14, 11, 23, 4, 20, 13, 11, 7, 29, 8, 31, 6, 22, 17, 28, 4, 37, 19, 26, 8, 41, 14, 43, 11, 16, 23, 47, 6, 49, 20, 34, 13, 53, 11, 44, 14, 38, 29, 59, 8, 61, 31, 28, 11, 52, 22, 67, 17, 46, 28, 71, 8, 73, 37, 40, 19, 77, 26
Offset: 1

Views

Author

W. Edwin Clark, Sep 22 2024

Keywords

Comments

The values of n for which a(n) = n seem to be A007775, but I have no proof of this.

Crossrefs

Programs

  • Maple
    a:=proc(n)
    local x,y,z,N;
    N:=NULL;
    for x from 0 to n-1 do
     for y from x to n-1 do
      for z from y to n-1 do
       if (x*y*z) mod n = 1 mod n then N:=N,(x+y+z) mod n; fi;
      od:
     od:
    od:
    nops({N});
    end:
  • PARI
    a(n)=my(v=vectorsmall(n)); for(x=1,n, if(gcd(x,n)>1, next); for(y=1,x, if(gcd(y,n)>1, next); my(z=1/Mod(x*y,n)); v[lift(x+y+z)+1]=1)); sum(i=1,n, v[i]) \\ Charles R Greathouse IV, Sep 23 2024
  • Python
    def A376318(n):
        s = set()
        for x in range(n):
            for y in range(x,n):
                try:
                    s.add((x+y+pow(x*y%n,-1,n))%n)
                except:
                    continue
        return len(s) # Chai Wah Wu, Sep 23 2024
    
Showing 1-5 of 5 results.