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

A100449 Number of ordered pairs (i,j) with |i| + |j| <= n and gcd(i,j) <= 1.

Original entry on oeis.org

1, 5, 9, 17, 25, 41, 49, 73, 89, 113, 129, 169, 185, 233, 257, 289, 321, 385, 409, 481, 513, 561, 601, 689, 721, 801, 849, 921, 969, 1081, 1113, 1233, 1297, 1377, 1441, 1537, 1585, 1729, 1801, 1897, 1961, 2121, 2169, 2337, 2417, 2513, 2601, 2785, 2849, 3017
Offset: 0

Views

Author

N. J. A. Sloane, Nov 21 2004

Keywords

Comments

Note that gcd(0,m) = m for any m.
I would also like to get the sequences of the numbers of distinct sums i+j (also distinct products i*j) over all ordered pairs (i,j) with |i| + |j| <= n; also over all ordered pairs (i,j) with |i| + |j| <= n and gcd(i,j) <= 1.
From Robert Price, May 10 2013: (Start)
List of sequences that address these extensions:
Distinct sums i+j with or without the GCD qualifier results in a(n)=2n+1 (A005408).
Distinct products i*j without the GCD qualifier is given by A225523.
Distinct products i*j with the GCD qualifier is given by A225526.
With the restriction i,j >= 0 ...
Distinct sums or products equal to n is trivial and always equals one (A000012).
Distinct sums <=n with or without the GCD qualifier results in a(n)=n (A001477).
Distinct products <=n without the GCD qualifier is given by A225527.
Distinct products <=n with the GCD qualifier is given by A225529.
Ordered pairs with the sum = n without the GCD qualifier is a(n)=n+1.
Ordered pairs with the sum = n with the GCD qualifier is A225530.
Ordered pairs with the sum <=n without the GCD qualifier is A000217(n+1).
Ordered pairs with the sum <=n with the GCD qualifier is A225531.
(End)
This sequence (A100449) without the GCD qualifier results in A001844. - Robert Price, Jun 04 2013

Crossrefs

Programs

  • Maple
    f:=proc(n) local i,j,k,t1,t2,t3; t1:=0; for i from -n to n do for j from -n to n do if abs(i) + abs(j) <= n then t2:=gcd(i,j); if t2 <= 1 then t1:=t1+1; fi; fi; od: od: t1; end;
    # second Maple program:
    b:= proc(n) b(n):= numtheory[phi](n)+`if`(n=0, 0, b(n-1)) end:
    a:= n-> 1+4*b(n):
    seq(a(n), n=0..50);  # Alois P. Heinz, Mar 01 2013
  • Mathematica
    f[n_] := Length[ Union[ Flatten[ Table[ If[ Abs[i] + Abs[j] <= n && GCD[i, j] <= 1, {i, j}, {0, 0}], {i, -n, n}, {j, -n, n}], 1]]]; Table[ f[n], {n, 0, 49}] (* Robert G. Wilson v, Dec 14 2004 *)
  • PARI
    a(n) = 1+4*sum(k=1, n, eulerphi(k) ); \\ Joerg Arndt, May 10 2013
    
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A100449(n):
        if n == 0:
            return 1
        c, j = 0, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += (j2-j)*((A100449(k1)-3)//2)
            j, k1 = j2, n//j2
        return 2*(n*(n-1)-c+j)+1 # Chai Wah Wu, Mar 29 2021

Formula

a(n) = 1 + 4*Sum(phi(k), k=1..n) = 1 + 4*A002088(n). - Vladeta Jovovic, Nov 25 2004

Extensions

More terms from Vladeta Jovovic, Nov 25 2004

A295976 Number of nonnegative solutions to (x,y) = 1 and x^3 + y^3 = n.

Original entry on oeis.org

0, 2, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2
Offset: 0

Views

Author

Seiichi Manyama, Dec 01 2017

Keywords

Comments

Number of ordered pairs of two nonnegative natural numbers that are coprime and whose cubes add to n. - Antti Karttunen, May 31 2021

Examples

			For 1729, a(1729) = 4, because the following four ordered pairs, (1,12),  (9,10),  (10,9) and (12,1) satisfy the condition, as 1^3 + 12^3 = 9^3 + 10^3 = 1729. - _Antti Karttunen_, May 31 2021
		

Crossrefs

Programs

  • PARI
    {a(n) = sum(i=0, n, sum(j=0, n, if((gcd(i, j)==1) && (i^3+j^3==n), 1, 0)))}
    
  • PARI
    A295976(n) = { my(s=0); for(i=0, oo, i3 = i^3; forstep(j=n-i3, 0, -1, if((i3+j^3==n) && gcd(i, j)==1, s++)); if(i3>n, return(s))); }; \\ Antti Karttunen, May 31 2021
Showing 1-2 of 2 results.