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.

Previous Showing 21-25 of 25 results.

A339756 Mark each point on the n X n X n grid with the number of points that are visible from it; a(n) is the number of distinct values in the grid.

Original entry on oeis.org

1, 4, 4, 8, 4, 17, 12, 15, 14, 33, 12, 58, 28, 43, 52, 113, 39, 140, 57, 124, 129, 240, 66, 241, 173, 270, 217, 362, 58, 388, 292, 454, 351, 539, 166, 783, 471, 723, 463, 880, 229, 1134, 642, 843, 763, 1441, 311, 1415, 740, 1295, 987, 1888, 357, 1629, 1063, 1750, 1231, 2381, 289, 2652
Offset: 1

Views

Author

Torlach Rush, Dec 15 2020

Keywords

Comments

a(n) <= A058187(n). This is because A058187(n) is the maximum number of points required to calculate a(n).

Examples

			a(1) = 1 because there are 7 visible points from every point on the grid.
a(2) = 4 because 19 points are visible from every vertex of the grid, 23 points are visible from the midpoint of every edge of the grid, 25 points are visible from the midpoint of every face of the grid, and 26 points are visible from the middle of the grid.
a(3) = 4 because 49 points are visible from every vertex of the grid, 53 points are visible from the inner points of every edge of the grid, 55 points are visible from the inner points of every face of the grid, and 56 points are visible from the inner points of the grid.
		

Crossrefs

Programs

  • PARI
    \\ n = side length, d = dimension
    cdvps(n, d) ={my(m=Map());
      forvec(u=vector(d, i, [0, n\2]),
        my(c=0); forvec(v=[[t-n, t]|t<-u], c+=(gcd(v)==1));
        mapput(m, c, 1), 1);
      #m; }
    a(n) = cdvps(n, 3)

A344533 Given a square forest of n X n trees, with rows and columns separated by 1 meter, a(n) is the number of trees visible to an observer halfway along one side of the forest, exactly one meter outside.

Original entry on oeis.org

1, 4, 7, 14, 17, 30, 33, 52, 51, 82, 81, 108, 105, 156, 143, 198, 183, 252, 231, 308, 267, 380, 339, 436, 383, 526, 461, 598, 525, 680, 595, 782, 663, 896, 767, 974, 839, 1118, 953, 1208, 1041, 1330, 1143, 1466, 1227, 1620, 1383, 1738, 1473, 1898, 1605, 2034
Offset: 1

Views

Author

John Mason, May 22 2021

Keywords

Comments

This concept has been studied under the name "visible lattice points" although the usual version considers the points in an n X n grid that are visible from the origin. - Jeffrey Shallit, May 22 2021

Examples

			For example, if the forest contains 5 X 5 trees, the observer will see only 17, as 8 will be hidden.
		

Crossrefs

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

A175549 Number of triples (a, b, c) with gcd(a, b, c) = 1 and -n <= a,b,c <= n.

Original entry on oeis.org

0, 26, 98, 290, 578, 1154, 1730, 2882, 4034, 5762, 7490, 10370, 12674, 16706, 20162, 24770, 29378, 36290, 41474, 50114, 57026, 66242, 74882, 87554, 96770, 111170, 123266, 138818, 152642, 172802, 186626, 209666, 228098, 251138, 271874, 299522
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Table[If[n>0, 8 * Sum[MoebiusMu[k] * ((Floor[n/k] + 1)^3 - 1), {k, 1, n}] - 24 * Sum[EulerPhi[k], {k, 1, n}] - 6, 0], {n, 0, 35}] (* Indranil Ghosh, Mar 11 2017 *)
  • PARI
    a(n)=if(n>0,8*sum(k=1,n,moebius(k)*((n\k+1)^3-1))-24*sum(k=1,n,eulerphi(k))-6)
    
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A175549(n):
        if n == 0:
            return 0
        c, j = 0, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += (j2-j)*A175549(k1)
            j, k1 = j2, n//j2
        return 4*n*(n - 1)*(2*n + 5)-c+26*(j-1)# Chai Wah Wu, Mar 30 2021

Formula

For n > 0, a(n) = 8*A090025(n) - 12*A018805(n) - 18.
a(n) = 2*n*(4*n^2 + 6*n + 3) - Sum_{j=2..n} a(floor(n/j)). - Chai Wah Wu, Mar 30 2021

Extensions

Edited by Charles R Greathouse IV, Jul 19 2010

A360452 Number of fractions c/d with |c| <= d <= 2n and odd denominator when factors of 2 are canceled.

Original entry on oeis.org

0, 3, 7, 15, 27, 39, 59, 83, 99, 131, 167, 191, 235, 275, 311, 367, 427, 467, 515, 587, 635, 715, 799, 847, 939, 1023, 1087, 1191, 1271, 1343, 1459, 1579, 1651, 1747, 1879, 1967, 2107, 2251, 2331, 2451, 2607, 2715, 2879, 3007, 3119, 3295, 3439, 3559, 3703, 3895, 4015
Offset: 0

Views

Author

M. F. Hasler, Mar 26 2023

Keywords

Comments

Using d <= 2n or d <= 2n-1 gives the same result, therefore we use 2n and not just n for the upper limit of the denominator. Indeed, using an even d will only yield the same simplified fractions with odd denominators as one gets for d/2.

Examples

			For n = 0, there is no possible fraction, since the denominator can't be zero.
For n = 1, we have a(1) = #{ -1/1, 0/1, 1/1} = 3; using denominator d = 2 would not give other elements with odd denominator after cancellations, cf. comments.
For n = 2, we have a(2) = #{-1/1, -2/3, -1/3, 0, 1/3, 2/3, 1/1} = 7.
For n = 3, we have a(3) = #{-1/1, -4/5, -2/3, -3/5, -2/5, -1/3, -1/5, 0, 1/5, 1/3, 2/5, 3/5, 2/3, 4/5, 1/1} = 15. As explained in comments, only odd d are useful.
		

Crossrefs

Programs

  • PARI
    a(n)=#Set(concat([[c/d|c<-[-d..d],d && denominator(c/d)%2]|d<-[0..n*2]])) \\ For illustration only. Remove the # to see the elements. Obviously the code could be optimized.
    
  • PARI
    apply( {A360452(n) = sum(i=0, n-1, eulerphi(2*i+1))*2+!!n}, [0..10]) \\ This should be used to define the "official" function A360452.
    
  • Python
    # uses programs from A002088 and A049690
    def A360452(n): return (A002088((n<<1)-1)-A049690(n-1)<<1)|1 if n else 0 # Chai Wah Wu, Aug 04 2024

Formula

a(n) = 2*A099957(n)+1 for n > 0.
Previous Showing 21-25 of 25 results.