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.

A049691 a(n)=T(n,n), array T as in A049687. Also a(n)=T(2n,2n), array T given by A049639.

Original entry on oeis.org

0, 3, 5, 9, 13, 21, 25, 37, 45, 57, 65, 85, 93, 117, 129, 145, 161, 193, 205, 241, 257, 281, 301, 345, 361, 401, 425, 461, 485, 541, 557, 617, 649, 689, 721, 769, 793, 865, 901, 949, 981, 1061, 1085, 1169, 1209, 1257, 1301, 1393, 1425, 1509, 1549
Offset: 0

Views

Author

Keywords

Comments

a(n) is related to the sequence b(n) = |{(x, y): gcd(x, y) = 1, 1<=x, y<=n}| (A018805) as follows: a(n) = b(n - 1) + 2 (for n > 1). - Shawn Westmoreland (westmore(AT)math.utexas.edu), Jun 11 2003
Comment from N. J. A. Sloane, Sep 08 2019 (Start)
The above comment can be rephrased as saying that a(n) is the cardinality of the subsequence F(B(2n),n) of the Farey series F_{2n} that is extensively studied in Matveev (2017). See the definition on page 1.
For example, F(B(2),1), F(B(4),2), F(B(6),3), and F(B(8),4) are:
[0, 1/2, 1],
[0, 1/3, 1/2, 2/3, 1],
[0, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 1],
[0, 1/5, 1/4, 1/3, 2/5, 3/7, 1/2, 4/7, 3/5, 2/3, 3/4, 4/5, 1],
of cardinalities 3,5,9,13 respectively. See also A324796/A324797. (End)
a(n) is the number of visible points on an n X n square lattice when viewed from (0, 0), (0, n), (n, 0), or (n, n). - Torlach Rush, Nov 16 2020
Also number of elements in { c/d ; -d <= c <= d <= n }, i.e., distinct fractions with denominator not exceeding n and absolute value of numerator not exceeding the denominator. - M. F. Hasler, Mar 26 2023

References

  • A. O. Matveev, Farey Sequences, De Gruyter, 2017.

Crossrefs

A206297 is an essentially identical sequence.

Programs

  • Maple
    Farey := proc(n) sort(convert(`union`({0}, {seq(seq(m/k, m=1..k), k=1..n)}), list)) end: # A006842/A006843
    BF := proc(m) local a,i,h,k; global Farey; a:=[];
    for i in Farey(2*m) do h:=numer(i); k:=denom(i);
    if (h <= m) and (k-m <= h) then a:=[op(a),i]; fi; od: a; end;
    [seq(nops(BF(m),m=1..20)]; # this sequence - N. J. A. Sloane, Sep 08 2019
  • Mathematica
    a[0] = 0; a[n_] := 2 + Sum[Quotient[n, g]^2*MoebiusMu[g], {g, 1, n}]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Oct 07 2017, translated from PARI *)
  • PARI
    a(n) = if(n>0, 2, 0) + sum(g=1, n, (n\g)^2 * moebius(g)); \\ Andrew Howroyd, Sep 17 2017
    
  • PARI
    a(n) = if(n>0, 1, 0) + 2 * sum(k=1, n, eulerphi(k)); \\ Torlach Rush, Nov 24 2020
    
  • PARI
    a(n)=#Set(concat([[c/d|c<-[-d..d],d]|d<-[0..n]])) \\ For illustrative purpose only! - M. F. Hasler, Mar 26 2023
    
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A049691(n):
        if n == 0:
            return 0
        c, j = 1, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += (j2-j)*(A049691(k1)-2)
            j, k1 = j2, n//j2
        return n*(n-1)-c+j+2 # Chai Wah Wu, Aug 04 2024

Formula

a(n) = A206297(n+1) = 2 + A018805(n) for n > 0. - Andrew Howroyd, Sep 17 2017
a(n) = 1 + 2 * Sum{k=1..n} A000010(k), n > 0. - Torlach Rush, Nov 24 2020

Extensions

Terms a(41) and beyond from Andrew Howroyd, Sep 17 2017

A206350 Position of 1/n in the canonical bijection from the positive integers to the positive rational numbers.

Original entry on oeis.org

1, 2, 4, 8, 12, 20, 24, 36, 44, 56, 64, 84, 92, 116, 128, 144, 160, 192, 204, 240, 256, 280, 300, 344, 360, 400, 424, 460, 484, 540, 556, 616, 648, 688, 720, 768, 792, 864, 900, 948, 980, 1060, 1084, 1168, 1208, 1256, 1300, 1392, 1424, 1508, 1548
Offset: 1

Views

Author

Clark Kimberling, Feb 06 2012

Keywords

Comments

The canonical bijection from the positive integers to the positive rational numbers is given by A038568(n)/A038569(n).
Appears to be a variant of A049696. - R. J. Mathar, Feb 11 2012
Apparently numbers m such that A071912(m) = 1. - Bill McEachen, Aug 01 2023

Examples

			The canonical bijection starts with 1/1, 1/2, 2/1, 1/3, 3/1, 2/3, 3/2, 1/4, 4/1, 3/4, 4/3, 1/5, 5/1, so that A206297 starts with 1,3,5,9,13 and this sequence starts with 1,2,4,8,12.
		

Crossrefs

Programs

  • Magma
    [1] cat [2*(&+[EulerPhi(k): k in [1..n-1]]): n in [2..80]]; // G. C. Greubel, Mar 29 2023
    
  • Maple
    1, op(2*ListTools:-PartialSums(map(numtheory:-phi, [$1..100]))); # Robert Israel, Apr 24 2015
  • Mathematica
    a[n_]:= Module[{s=1, k=2, j=1},
      While[s<=n, s= s + 2*EulerPhi[k]; k= k+1];
      s = s - 2*EulerPhi[k-1];
      While[s<=n, If[GCD[j, k-1] == 1,
        s = s+2]; j = j+1];
      If[s>n+1, j-1, k-1]];
    t = Table[a[n], {n, 0, 3000}];   (* A038568 *)
    ReplacePart[Flatten[Position[t, 1]], 1, 1] (* A206350 *)
    (* Second program *)
    a[n_]:= If[n==1, 1, 2*Sum[EulerPhi[k], {k, n-1}]];;
    Table[a[n], {n, 80}] (* G. C. Greubel, Mar 29 2023 *)
  • SageMath
    def A206350(n): return 1 if (n==1) else 2*sum(euler_phi(k) for k in range(1,n))
    [A206350(n) for n in range(1,80)] # G. C. Greubel, Mar 29 2023

Formula

a(1) = 1, a(n+1) = Sum_{k=1..n} mu(k) * floor(n/k) * floor(1 + n/k), where mu(k) is the Moebius function A008683. - Daniel Suteu, May 28 2018
a(n) = 2*Sum_{k=1..n-1} A000010(k), a(1) = 1. - Robert Israel, Apr 24 2015

A049644 T(n,n), array T given by A049639.

Original entry on oeis.org

0, 0, 3, 3, 5, 5, 9, 9, 13, 13, 21, 21, 25, 25, 37, 37, 45, 45, 57, 57, 65, 65, 85, 85, 93, 93, 117, 117, 129, 129, 145, 145, 161, 161, 193, 193, 205, 205, 241, 241, 257, 257, 281, 281, 301, 301, 345, 345, 361, 361, 401, 401, 425, 425, 461, 461, 485, 485, 541, 541, 557, 557
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    a[0 | 1, 0 | 1] = 0; a[0 | 1, ] = a[, 0 | 1] = 1; a[i_, j_] := Module[{slopes, cnt}, slopes = Union@Flatten@Table[(k - j)/(h - i), {h, 0, i - 1}, {k, 0, j - 1}]; cnt[slope_] := Count[Flatten[Table[{h, k}, {h, 0, i - 1}, {k, 0, j - 1}], 1], {h_, k_} /; (k - j)/(h - i) == slope]; Count[cnt /@ slopes, c_ /; c >= 2] + 2]; Table[a[n, n], {n, 0, 25}] (* G. C. Greubel, Dec 07 2017 *)

Extensions

Terms a(42) onward added by G. C. Greubel, Dec 10 2017
Showing 1-3 of 3 results.