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-3 of 3 results.

A050873 Triangular array T read by rows: T(n,k) = gcd(n,k).

Original entry on oeis.org

1, 1, 2, 1, 1, 3, 1, 2, 1, 4, 1, 1, 1, 1, 5, 1, 2, 3, 2, 1, 6, 1, 1, 1, 1, 1, 1, 7, 1, 2, 1, 4, 1, 2, 1, 8, 1, 1, 3, 1, 1, 3, 1, 1, 9, 1, 2, 1, 2, 5, 2, 1, 2, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 2, 3, 4, 1, 6, 1, 4, 3, 2, 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Keywords

Comments

The function T(n,k) = T(k,n) is defined for all integer k,n but only the values for 1 <= k <= n as a triangular array are listed here.
For each divisor d of n, the number of d's in row n is phi(n/d). Furthermore, if {a_1, a_2, ..., a_phi(n/d)} is the set of positive integers <= n/d that are relatively prime to n/d then T(n,a_i * d) = d. - Geoffrey Critzer, Feb 22 2015
Starting with any row n and working downwards, consider the infinite rectangular array with k = 1..n. A repeating pattern occurs every A003418(n) rows. For example, n=3: A003418(3) = 6. The 6-row pattern starting with row 3 is {1,1,3}, {1,2,1}, {1,1,1}, {1,2,3}, {1,1,1}, {1,2,1}, and this pattern repeats every 6 rows, i.e., starting with rows {9,15,21,27,...}. - Bob Selcoe and Jamie Morken, Aug 02 2017

Examples

			Rows:
  1;
  1, 2;
  1, 1, 3;
  1, 2, 1, 4;
  1, 1, 1, 1, 5;
  1, 2, 3, 2, 1, 6; ...
		

Crossrefs

Cf. A003989.
Cf. A018804 (row sums), A245717.
Cf. A132442 (sums of divisors).
Cf. A003418.

Programs

  • Haskell
    a050873 = gcd
    a050873_row n = a050873_tabl !! (n-1)
    a050873_tabl = zipWith (map . gcd ) [1..] a002260_tabl
    -- Reinhard Zumkeller, Dec 12 2015, Aug 13 2013, Jun 10 2013
  • Mathematica
    ColumnForm[Table[GCD[n, k], {k, 12}, {n, k}], Center] (* Alonso del Arte, Jan 14 2011 *)
  • PARI
    {T(n, k) = gcd(n, k)} /* Michael Somos, Jul 18 2011 */
    

Formula

a(n) = gcd(A002260(n), A002024(n)); A054521(n) = A000007(a(n)). - Reinhard Zumkeller, Dec 02 2009
T(n,k) = A075362(n,k)/A051173(n,k), 1 <= k <= n. - Reinhard Zumkeller, Apr 25 2011
T(n, k) = T(k, n) = T(-n, k) = T(n, -k) = T(n, n+k) = T(n+k, k). - Michael Somos, Jul 18 2011
T(n,k) = A051173(n,k) / A051537(n,k). - Reinhard Zumkeller, Jul 07 2013

A078430 Sum of gcd(k^2,n) for 1 <= k <= n.

Original entry on oeis.org

1, 3, 5, 10, 9, 15, 13, 28, 33, 27, 21, 50, 25, 39, 45, 88, 33, 99, 37, 90, 65, 63, 45, 140, 145, 75, 153, 130, 57, 135, 61, 240, 105, 99, 117, 330, 73, 111, 125, 252, 81, 195, 85, 210, 297, 135, 93, 440, 385, 435, 165, 250, 105, 459, 189, 364, 185, 171, 117, 450, 121
Offset: 1

Views

Author

Vladeta Jovovic, Dec 30 2002

Keywords

Comments

a(n) is the number of non-congruent solutions to x^2*y = 0 mod n. - Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 17 2003
Row sums of triangle A245717. - Reinhard Zumkeller, Jul 30 2014

Crossrefs

Programs

  • Haskell
    a078430 = sum . a245717_row  -- Reinhard Zumkeller, Jul 30 2014
    
  • Mathematica
    Table[Sum[GCD[k^2,n],{k,n}],{n,70}] (* Harvey P. Dale, Sep 29 2014 *)
    f[p_, e_] := If[EvenQ[e], p^(3*e/2) + p^(3*e/2 - 1), 2*p^((3*e - 1)/2)] - p^(e - 1); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Apr 28 2023 *)
  • PARI
    a(n) = sum(k=1,n, gcd(k^2, n)); \\ Michel Marcus, Aug 03 2016

Formula

a(n) is multiplicative. G.f. for a(p^n), p a prime, is given by (1+(p-1)*x-p^2*x^2)/(1-p*x)/(1-p^3*x^2).
a(n) = n*Sum_{d|n} phi(d)*N(d)/d, where phi is Euler's totient function A000010 and N(n) is sequence A000188. - Laszlo Toth, Apr 15 2012
Multiplicative with a(p^e) = p^(3*e/2) + p^(3*e/2-1) - p^(e-1) if e is even, and 2*p^((3*e-1)/2) - p^(e-1) if e is odd. - Amiram Eldar, Apr 28 2023

A353909 a(n) is the alternating sum of the sequence gcd(n, k^2), 1 <= k <= n.

Original entry on oeis.org

-1, 1, -3, 6, -5, 5, -7, 20, -9, 9, -11, 30, -13, 13, -15, 72, -17, 33, -19, 54, -21, 21, -23, 100, -25, 25, -27, 78, -29, 45, -31, 208, -33, 33, -35, 198, -37, 37, -39, 180, -41, 65, -43, 126, -45, 45, -47, 360, -49, 145, -51, 150, -53, 153, -55, 260, -57, 57, -59
Offset: 1

Views

Author

Thomas Baeyens, May 10 2022

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> add((-1)^i*igcd(n, i^2), i=1..n):
    seq(a(n), n=1..60);  # Alois P. Heinz, Jan 13 2023
  • Mathematica
    a[n_] := Sum[(-1)^i * GCD[n, i^2], {i, 1, n}]; Array[a, 100] (* Amiram Eldar, May 10 2022 *)
  • PARI
    a(n) = sum(i=1, n, (-1)^i*gcd(n, i^2)); \\ Michel Marcus, May 10 2022
    
  • PARI
    a(n) = {
       if((n%2)==1, return(-n));
       my(s=0);
       fordivfactored(n, d,
          if((d[1]%2)==0,
             s+=eulerphi(d)*core(d,1)[2]/d[1]));
       s*n;
    } \\ Yurii Ivanov, Jun 20 2022
    
  • Python
    from math import gcd
    def a(n):
        return -n if n%2==1 else sum((-1)**k*gcd(n, k*k) for k in range(1, n+1))
    print([a(n) for n in range(1, 60)]) # Michael S. Branicky, May 28 2022
    
  • Python
    from sympy import sqrt, divisors, totient
    from sympy.ntheory.factor_ import core
    def a(n):
      return -n if n & 1 == 1 else int(n * sum(totient(d) * sqrt(d // core(d)) / d for d in divisors(n) if d & 1 == 0))
     # Darío Clavijo, Dec 29 2022

Formula

a(n) = Sum_{i=1..n} (-1)^i*gcd(n, i^2).
a(n) = -n if n is odd.
a(n) = n * Sum_{d|n, d even} (phi(d) * sqrt(d/core(d)) / d), where phi = A000010, if n is even. - Darío Clavijo, Jan 13 2023
Showing 1-3 of 3 results.