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-10 of 12 results. Next

A097269 Numbers that are the sum of two nonzero squares but not the difference of two nonzero squares.

Original entry on oeis.org

2, 10, 18, 26, 34, 50, 58, 74, 82, 90, 98, 106, 122, 130, 146, 162, 170, 178, 194, 202, 218, 226, 234, 242, 250, 274, 290, 298, 306, 314, 338, 346, 362, 370, 386, 394, 410, 442, 450, 458, 466, 482, 490, 514, 522, 530, 538, 554, 562, 578, 586, 610, 626, 634
Offset: 1

Views

Author

Ray Chandler, Aug 19 2004

Keywords

Comments

Intersection of A000404 (sum of squares) and complement of A024352 (difference of squares).
Numbers of the form 4k+2 = double of an odd number, with the odd number equal to the sum of 2 squares (sequence A057653). - Jean-Christophe Hervé, Oct 24 2015
Numbers that are the sum of two odd squares. - Jean-Christophe Hervé, Oct 25 2015

Examples

			2 = 1^2 + 1^2, 10 = 1^2 + 3^2, 18 = 3^2 + 3^2.
		

Crossrefs

Programs

  • PARI
    is(n)=if(n%4!=2,return(0)); my(f=factor(n/2)); for(i=1,#f[,1],if(bitand(f[i,2],1)==1&&bitand(f[i,1],3)==3, return(0))); 1 \\ Charles R Greathouse IV, May 31 2013
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A097269_gen(): # generator of terms
        return filter(lambda n:all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n//2).items()),count(2,4))
    A097269_list = list(islice(A097269_gen(),30)) # Chai Wah Wu, Jun 28 2022

A234334 Numbers k such that both distances from k to two nearest squares are perfect squares.

Original entry on oeis.org

0, 1, 5, 8, 25, 40, 45, 65, 80, 153, 160, 169, 200, 221, 325, 360, 416, 425, 493, 520, 625, 680, 725, 925, 936, 1025, 1040, 1073, 1088, 1305, 1360, 1681, 1768, 1800, 1813, 1845, 1961, 2000, 2320, 2385, 2501, 2600, 2925, 3016, 3185, 3200, 3400, 3445, 3721, 3848
Offset: 1

Views

Author

Alex Ratushnyak, Dec 23 2013

Keywords

Comments

Except a(1)=0, a(n) are numbers k such that both k-x and y-k are perfect squares, where x and y are two nearest to k squares: x < k <= y.
The sequence of sums of distances begins: 1, 1, 5, 5, 9, 13, 13, 17, 17, 25, 25, 25, 29, 29, 37, 37, 41, 41, 45, 45, 49, 53, 53, 61, 61, 65, 65, 65, 65, 73, 73, 81, 85, ... (cf. A057653).
Each term is either a square or has a pair: if i^2 + j^2 = 2*m+1 then m^2+i^2 and m^2+j^2 are both in the sequence.

Examples

			The two squares nearest to 25 are 16 and 25, because both 25-25=0 and 25-16=9 are squares, 25 is in the sequence.
The two squares nearest to 45 are 36 and 49, because both 45-36=9 and 49-45=4 are squares, 45 is in the sequence.
		

Crossrefs

Cf. A000290.
Cf. subsequences: A007204, A234335, A234336.
Cf. A234348.

Programs

  • Maple
    filter:= proc(n) local a;
      if issqr(n) then a:= sqrt(n)-1 else a:= floor(sqrt(n)) fi;
      issqr(n-a^2) and issqr((a+1)^2-n)
    end proc:
    select(filter, [$0..5000]); # Robert Israel, Jan 21 2021
  • Mathematica
    filter[n_] := If[n == 0, True, Module[{a}, a = If[IntegerQ @ Sqrt[n], Sqrt[n]-1, Floor[Sqrt[n]]]; IntegerQ @ Sqrt[n-a^2] && IntegerQ@Sqrt[(a+1)^2-n]]];
    Select[Range[0, 5000], filter] (* Jean-François Alcover, May 28 2023, after Robert Israel *)

A263715 Nonnegative integers that are the sum or difference of two squares.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80
Offset: 1

Views

Author

Jean-Christophe Hervé, Oct 24 2015

Keywords

Comments

Contains all integers that are not equal to 2 (mod 4) (they are of the form y^2 - x^2) and those of the form 4k+2 = 2*(2k+1) with the odd number 2k+1 equal to the sum of two squares (A057653).

Examples

			2 = 1^2 + 1^2, 3 = 2^2 - 1^2, 4 = 2^2 + 0^2, 5 = 2^2 + 1^2 = 3^2 - 2^2.
		

Crossrefs

Programs

  • Mathematica
    r[n_] := Reduce[n == x^2 + y^2, {x, y}, Integers] || Reduce[0 <= y <= x && n == x^2 - y^2, {x, y}, Integers]; Reap[Do[If[r[n] =!= False, Sow[n]], {n, 0, 80}]][[2, 1]] (* Jean-François Alcover, Oct 25 2015 *)
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A263715_gen(): # generator of terms
        return filter(lambda n: n & 3 != 2 or all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items()),count(0))
    A263715_list = list(islice(A263715_gen(),30)) # Chai Wah Wu, Jun 28 2022

Formula

Union of A001481 (sums of two squares) and A042965 (differences of two squares).
Union of A042965 and 2*A057653 = A097269, with intersection of A042965 and A097269 = {}.
Union of A020668 (x^2+y^2 and a^2-b^2), A097269 (x^2+y^2, not a^2-b^2) and A263737 (not x^2+y^2, a^2-b^2).

A234434 Number of shapes of grid-filling curves (on the triangular grid) with turns by 0, +120, or -120 degrees that are generated by Lindenmayer-systems with just one symbol apart from the turns.

Original entry on oeis.org

1, 1, 0, 0, 3, 0, 5, 0, 0, 10, 15, 0, 0, 17, 0, 0, 71, 0, 213, 0, 0, 0, 184, 0, 549, 845, 0, 0, 1850, 0, 0, 0, 0, 6700, 9787, 0, 30475, 0, 0, 0, 52184, 0, 0, 0, 0, 182043, 401377, 0, 0, 604809, 0, 0, 0, 0, 4318067, 0, 0, 0, 7158120, 0
Offset: 3

Views

Author

Joerg Arndt, Dec 26 2013

Keywords

Comments

Shapes are considered modulo reflections and rotations.
The curves considered are not self-intersecting, not edge-contacting (i.e., have double edges), but (necessarily) vertex-contacting (i.e., a point in the grid is visited more than once).
The L-systems are interpreted as follows: 'F' is a unit-stroke in the current direction, '+' is a turn left by 120 degrees, '-' a turn right by 120 degrees, and '0' means "no turn".
The images in the links section use rounded corners to make the curves visually better apparent.
Three copies of each curve (connected by three turns '+' or three turns '-') give two tiles (that tile the triangular grid), but symmetric curves (any symmetry) give just one tile(-shape). The tiles are 3-symmetric, and sometimes (only for n of the form 6*k+1) 6-symmetric. There could in general be more tile-shapes than curve-shapes, for n=7 both cardinalities coincide, see links section. It turns out that for large n there are actually fewer tile-shapes than curve-shapes.
Terms a(n) are nonzero for n>=3 if and only if n is a term of A003136.
The equivalent sequence for the square grid has nonzero terms for n>=5 that are terms of A057653.
If more symbols are allowed for the L-systems, more curves are found, also if strokes of lengths other than one unit are allowed, see the Ventrella reference.
For n = 49 there are two pairs (x, y) such that x^2 + x*y + y^2 = n, (7, 0) and (5, 3), respectively giving 132271 and 269106 shapes (a(49) = 401377 = 132271 + 269106). The next n with two such pairs (x, y) is n = 91, with pairs (6, 5) and (9, 1) - Joerg Arndt, Apr 07 2019

Examples

			The a(3)=1 shape of order 3 is generated by F |--> F+F-F, the curve generated by F |--> F-F+F has the same shape (after reflection). The curve is called the "terdragon", see A080846.
There are 5 L-systems that generate a curve of order 7 with first turn '0' or '+':
F |--> F0F+F0F-F-F+F  #  R7-1
F |--> F0F+F+F-F-F0F  #  R7-2
F |--> F+F0F+F-F0F-F  #  R7-3
F |--> F+F-F-F0F+F0F  #  R7-4 # same shape as R7-1
F |--> F+F-F-F+F+F-F  #  R7-5 # same shape as R7-2
As shown, these give just 3 shapes (and the L-systems with first turn '-' give no new shapes), so a(7)=3.
The curve R7-1 appears on page 107 in the Ventrella reference.
The symmetric curves R7-2 and R7-5 appear in the Arndt reference (there named "R7-dragon" and "second R7-dragon", see A176405 and A176416).
		

Crossrefs

Cf. A265685 (shapes on the square grid), A265686 (tri-hexagonal grid).

Extensions

Terms a(21), a(27), a(28), and a(31) corrected by Joerg Arndt, Jun 20 2018
Terms a(32) - a(47) from Joerg Arndt, Jun 22 2018
Terms a(48) - a(51) from Joerg Arndt, Nov 18 2018
Terms a(52) - a(56) added and a(48) - a(49) corrected, Joerg Arndt, Apr 07 2019
Terms a(57) - a(62) from Joerg Arndt, Apr 10 2019

A265685 Number of shapes of grid-filling curves of order 4*n+1 (on the square grid) with turns by +-90 degrees that are generated by Lindenmayer-systems with just one symbol apart from the turns.

Original entry on oeis.org

1, 1, 4, 6, 0, 33, 39, 0, 164, 335, 0, 603, 2467, 0, 10412, 19692, 0, 79494, 0, 155155, 1271455, 1272243, 0
Offset: 1

Views

Author

Joerg Arndt, Dec 13 2015

Keywords

Comments

Such curves exist only for n such that 4*n+1 is a term of A057653.

Crossrefs

Cf. A234434 (shapes on the triangular grid), A265686 (tri-hexagonal grid).
Cf. A296148 (folding curves of order n) and A296149 (folding curves of order 4*n+1).
Cf. A306358 (curve orders with at least two decomposition x^2 + y^2).

Extensions

a(15)..a(23) from Joerg Arndt, Feb 12 2019

A294774 a(n) = 2*n^2 + 2*n + 5.

Original entry on oeis.org

5, 9, 17, 29, 45, 65, 89, 117, 149, 185, 225, 269, 317, 369, 425, 485, 549, 617, 689, 765, 845, 929, 1017, 1109, 1205, 1305, 1409, 1517, 1629, 1745, 1865, 1989, 2117, 2249, 2385, 2525, 2669, 2817, 2969, 3125, 3285, 3449, 3617, 3789, 3965, 4145, 4329, 4517, 4709, 4905
Offset: 0

Views

Author

Bruno Berselli, Nov 08 2017

Keywords

Comments

This is the case k = 9 of 2*n^2 + (1-(-1)^k)*n + (2*k-(-1)^k+1)/4 (similar sequences are listed in Crossrefs section). Note that:
2*( 2*n^2 + (1-(-1)^k)*n + (2*k-(-1)^k+1)/4 ) - k = ( 2*n + (1-(-1)^k)/2 )^2. From this follows an alternative definition for the sequence: Numbers h such that 2*h - 9 is a square. Therefore, if a(n) is a square then its base is a term of A075841.

Crossrefs

1st diagonal of A154631, 3rd diagonal of A055096, 4th diagonal of A070216.
Second column of Mathar's array in A016813 (Comments section).
Subsequence of A001481, A001983, A004766, A020668, A046711 and A057653 (because a(n) = (n+2)^2 + (n-1)^2); A097268 (because it is also a(n) = (n^2+n+3)^2 - (n^2+n+2)^2); A047270; A243182 (for y=1).
Similar sequences (see the first comment): A161532 (k=-14), A181510 (k=-13), A152811 (k=-12), A222182 (k=-11), A271625 (k=-10), A139570 (k=-9), (-1)*A147973 (k=-8), A059993 (k=-7), A268581 (k=-6), A090288 (k=-5), A054000 (k=-4), A142463 or A132209 (k=-3), A056220 (k=-2), A046092 (k=-1), A001105 (k=0), A001844 (k=1), A058331 (k=2), A051890 (k=3), A271624 (k=4), A097080 (k=5), A093328 (k=6), A271649 (k=7), A255843 (k=8), this sequence (k=9).

Programs

  • Maple
    seq(2*n^2 + 2*n + 5, n=0..100); # Robert Israel, Nov 10 2017
  • Mathematica
    Table[2n^2+2n+5,{n,0,50}] (* or *) LinearRecurrence[{3,-3,1},{5,9,17},50] (* Harvey P. Dale, Sep 18 2023 *)
  • PARI
    Vec((5 - 6*x + 5*x^2) / (1 - x)^3 + O(x^50)) \\ Colin Barker, Nov 13 2017

Formula

O.g.f.: (5 - 6*x + 5*x^2)/(1 - x)^3.
E.g.f.: (5 + 4*x + 2*x^2)*exp(x).
a(n) = a(-1-n) = 3*a(n-1) - 3*a(n-2) + a(n-3).
a(n) = 5*A000217(n+1) - 6*A000217(n) + 5*A000217(n-1).
n*a(n) - Sum_{j=0..n-1} a(j) = A002492(n) for n>0.
a(n) = Integral_{x=0..2n+4} |3-x| dx. - Pedro Caceres, Dec 29 2020

A339952 Numbers that are the sum of an even square > 0 and an odd square.

Original entry on oeis.org

5, 13, 17, 25, 29, 37, 41, 45, 53, 61, 65, 73, 85, 89, 97, 101, 109, 113, 117, 125, 137, 145, 149, 153, 157, 169, 173, 181, 185, 193, 197, 205, 221, 225, 229, 233, 241, 245, 257, 261, 265, 269, 277, 281, 289, 293, 305, 313, 317, 325, 333, 337, 349, 353, 365, 369, 373, 377
Offset: 1

Views

Author

Wesley Ivan Hurt, Dec 24 2020

Keywords

Examples

			13 is in the sequence since it is the sum of an even square > 0 and an odd square, 2^2 + 3^2 = 4 + 9 = 13.
		

Crossrefs

Programs

  • Mathematica
    Table[If[Sum[Sign[(Mod[i, 2] Mod[n - i + 1, 2] + Mod[i + 1, 2] Mod[n - i, 2])] (Floor[Sqrt[i]] - Floor[Sqrt[i - 1]]) (Floor[Sqrt[n - i]] - Floor[Sqrt[n - i - 1]]), {i, Floor[n/2]}] > 0, n, {}], {n, 500}] // Flatten
  • Python
    def aupto(limit):
      m = int(limit**.5) + 2
      es = [i*i for i in range(2, m, 2)]
      os = [i*i for i in range(1, m, 2)]
      return sorted(set(a+b for a in es for b in os if a+b <= limit))
    print(aupto(377)) # Michael S. Branicky, May 13 2021

A280965 Nonsquares whose distances to the two nearest squares are squares.

Original entry on oeis.org

5, 8, 40, 45, 65, 80, 153, 160, 200, 221, 325, 360, 416, 425, 493, 520, 680, 725, 925, 936, 1025, 1040, 1073, 1088, 1305, 1360, 1768, 1800, 1813, 1845, 1961, 2000, 2320, 2385, 2501, 2600, 2925, 3016, 3185, 3200, 3400, 3445, 3848, 3869, 3944, 3965, 4640, 4745, 5185, 5248, 5265, 5328, 5525, 5576, 5785, 5920, 6120
Offset: 1

Views

Author

Emmanuel Vantieghem, Feb 27 2017

Keywords

Comments

The sequence is infinite because there are terms of it between n^2 and (n+1)^2 whenever 2n+1 is a sum of two squares.

Examples

			a(3) = 40 because the two nearest squares are 36 and 49 and 40 - 36 = 4, 49 - 40 = 9 are both squares.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[6120], IntegerQ[Sqrt[# - (Floor[Sqrt[#]])^2]] && IntegerQ[Sqrt[(Ceiling[Sqrt[#]])^2 - #]] &]
  • PARI
    is(n)=my(k=sqrtint(n)); issquare(n-k^2) && issquare((k+1)^2-n) && n>k^2 \\ Charles R Greathouse IV, Feb 27 2017
    
  • PARI
    list(lim)=my(v=List(),k2,K2,n); for(k=2,sqrtint(lim\1)-1, k2=k^2; K2=(k+1)^2; for(s=1,sqrtint(K2-k2-1), n=k2+s^2; if(issquare(K2-n), listput(v,n)))); k2=sqrtint(lim\1)^2; K2=(sqrtint(lim\1)+1)^2; for(n=k2+1,lim, if(issquare(n-k2) && issquare(K2-n), listput(v, n))); Vec(v) \\ Charles R Greathouse IV, Feb 27 2017

A296149 Number of shapes of grid-filling curves of order 4*n+1 (on the square grid) with turns by +-90 degrees that are generated by folding morphisms.

Original entry on oeis.org

2, 3, 14, 32, 0, 287, 438, 0, 2242, 5080, 11122, 12374, 77469
Offset: 1

Views

Author

Joerg Arndt, Dec 06 2017

Keywords

Comments

Terms are nonzero if and only if 4*n+1 is a term of A057653.

Crossrefs

Cf. A296148 (number of folding curves of all orders).
Cf. A265685 (simple curves of order 4*n+1).

A339273 Sums of two nonzero even squares.

Original entry on oeis.org

8, 20, 32, 40, 52, 68, 72, 80, 100, 104, 116, 128, 136, 148, 160, 164, 180, 200, 208, 212, 232, 244, 260, 272, 288, 292, 296, 320, 328, 340, 356, 360, 388, 392, 400, 404, 416, 424, 436, 452, 464, 468, 488, 500, 512, 520, 544, 548, 580, 584, 592, 596, 612, 628, 640, 648, 656
Offset: 1

Views

Author

Wesley Ivan Hurt, Dec 24 2020

Keywords

Examples

			20 is in the sequence since it is the sum of two nonzero even squares, 2^2 + 4^2 = 4 + 16 = 20.
		

Crossrefs

Programs

  • Mathematica
    Table[If[Sum[Mod[i + 1, 2] Mod[n - i + 1, 2] (Floor[Sqrt[i]] - Floor[Sqrt[i - 1]]) (Floor[Sqrt[n - i]] - Floor[Sqrt[n - i - 1]]), {i, Floor[n/2]}] > 0, n, {}], {n, 700}] // Flatten

Formula

a(n) = 4*A000404(n).
Characteristic function: sign(Sum_{k=1..floor(n/2)} ((k+1) mod 2) * ((n-k+1) mod 2) * c(k) * c(n-k)), where c is the characteristic function of squares (A010052).
Showing 1-10 of 12 results. Next