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-30 of 40 results. Next

A309500 The minimal number of steps to return to the origin for a self-avoiding walk with step-length n on a 2D plane where at each step the walk must go to an unvisited point with integer coordinates as close as possible to the origin.

Original entry on oeis.org

4, 4, 4, 4, 36, 4, 4, 4, 4, 36, 4, 4, 122, 4, 36, 4, 198, 4, 4, 36, 4, 4, 4, 4, 436, 122, 4, 4, 632, 36, 4, 4, 4, 198, 36, 4, 694, 4, 122, 36
Offset: 1

Views

Author

Scott R. Shannon, Aug 05 2019

Keywords

Comments

Consider a walk on a 2D plane starting at the (0,0) origin. We introduce the following rules for the walk: 1. Each step is of length n. 2. The walk can only step to points with integer x and y coordinates. 3. The walk cannot go to a point already visited, nor can it backtrack on its very first step from the origin. 4. At each step the walk must always go to a point which is as close as possible to the origin. Given these rules, what is the minimum number of steps required for the walk to return to the origin? For step length n the sequence a(n) is the minimum number of steps.
For step lengths n which are not hypotenuses of any Pythagorean triple the solution is 4 as the walk will simply trace out a square e.g. step up, then right (or left), then down, then left (or right) back to the origin. This is true for n=1,2,3,4. But for step length 5 if the initially step is to (0,5) then by the rules the closest point to the origin for the next step now becomes (3,1) - the step must take the hypotenuse of a (3,4,5) triangle as clearly (3,1) is closer to the origin than (5,5). From here the walk must continue to pick the next point as close as possible to the origin which is 5 units away from its current coordinate, either directly left-right-up-down or by moving along the hypotenuse of a (3,4,5) triangle. Also note for n=5, and any step length which is the hypotenuse of a Pythagorean triple, the walk can also take a first step to (4,3) - this can result in a totally different path that may, or may not, lead back to the origin in fewer steps.
If the walk visits a point either on the x=0 or y=0 axis, or along the line y=x or y=-x, then it is likely that for the next step two points will be available which are equidistant from the origin. As we do not know which will lead to the minimum length walk we are searching for, the walker must explore both paths. Although the values of a(n) for the primitive Pythagorean triples are not particularly large, the total number of paths that must be recursively searched to find these minimum values increases extremely rapidly - to find a(37) required searching at least 400 million different paths, these being cut off by the walk either returning to the origin in fewer steps than the current minimum path, or by their step count surpassing the current minimum path. Due to the explosive increase in the total number of paths the exact value has only been determined for n=5. Assuming a first step to (0,5) or (4,3) the total number of paths is 26421. A n=5 random walk therefore has about a 1 in 2400 chance of taking one of the minimum 36 step walks.
For a(n) up to 40 it is found that for all n corresponding to Pythagorean triple hypotenuses that there are multiple paths corresponding to the minimum path value e.g. for n=5 there are 11 different paths all of which return to the origin after 36 steps. For n=37 there are 2048 different paths, once again showing the rapid increase in the total paths that must be explored to find the minimum.
Integer multiples of the hypotenuses of the primitive Pythagorean triples result in the same values for a(n) - simply scaling up the step length does not change the minimum path. However this is not necessarily true if the resulting hypotenuse has more than one triple e.g. n=25. The addition choice of a second Pythagorean triple greatly increases the number of paths to explore: finding a(26), which is the same as a(13), required searching about 550 paths, but a(25) requires searching at least 37 million paths.
It seems plausible that the path could be trapped by surrounding visited points during a very long walk and thus never be able to return to the origin. It is unknown if this can occur.
The author thanks Zachary Shannon and David Gundersen for discussions and efficiency improvements to the search program.
From Bert Dobbelaere, Aug 18 2019: (Start)
All terms are even. For odd n, consider the grid colored like a chessboard. It follows from the parity relation of Pythagorean triples that the destination of each step is of different color than the source. Hence each closed walk takes an even number of steps. For even n, no odd coordinates can be encountered, so we can divide the problem size by 2 until we are back in the odd case.
a(41) <= 1244 ; a(53) = 1528. (End)
From Scott R. Shannon, Oct 23 2019: (Start)
a(61) <= 3698 ; a(73) = 3080 ; a(89) = 1034 ; a(97) = 4734. These results indicate that for hypotenuse lengths n which have legs of approximately the same length the number of search paths to find the minimum is relatively small. For lengths which have legs of uneven length, e.g. 41, the number of search paths becomes extremely large; n = 41 requires searching at least 10^12 paths. (End)

Examples

			a(1) = 4. Path: (0,0)->(0,1)->(1,1)->(1,0)->(0,0).
a(5) = 36. Path: (0,0)->(4,3)->(1,-1)->(-3,2)->(0,-2)->(0,3)->(-3,-1)->(2,-1)->(-2,2)->(1,-2)->(1,3)->(-2,-1)->(2,2)->(-1,-2)->(-1,3)->(3,0)->(-2,0)->(2,3)->(-1,-1)->(3,2)->(3,-3)->(0,1)->(0,-4)->(-3,0)->(2,0)->(-2,3)->(-2,-2)->(2,1)->(-1,-3)->(-1,2)->(2,-2)->(-2,1)->(1,-3)->(1,2)->(4,-2)->(0,-5)->(0,0). Note this path is one of eleven with a total path length of 36. Five of those eleven paths step to (-3,2) on the third step while the other six step to (-2,3). The first step to the point (4,3) is required - a first step to (0,5) results in a minimum path length of 40.
		

Crossrefs

Formula

For step length n, also equal to the hypotenuse of one Pythagorean triple (a,b,n) where a>b, the first step of the walk can be either along the y axis or along the hypotenuse diagonal in the positive x-y direction (all other direction choices are equivalent by rotation/reflection). In the former case the first point will be (0,n), and thus the second point will be (b,n-a). From here a step directly left to (-(n-b),n-a) or diagonally down and left to (-(a-b),-(b-(n-a)) result in points equidistant from the origin - both are sqrt(3n^2-2bn-2an) from (0,0). So after only two steps two valid branches arise both of which must be explored. If instead the first step is along the hypotenuse to (a,b) then using simple algebra one can show that the next step will be to (-(n-a),b) if n>2b, else it will be to (a-b,-(a-b)) for n<2b. Note that in the former case the path (0,0)->(a,b)->(-(n-a),b) is rotationally symmetric to the path (0,0)->(0,n)->(b,n-a), so for step lengths n with n>2b only one of these options needs to be explored.

A386307 Ordered hypotenuses of Pythagorean triples that do not have the form (u^2 - v^2, 2*u*v, u^2 + v^2), where u and v are positive integers.

Original entry on oeis.org

15, 25, 30, 35, 39, 50, 51, 55, 60, 65, 65, 70, 75, 75, 78, 85, 85, 87, 91, 95, 100, 102, 105, 110, 111, 115, 119, 120, 123, 125, 130, 130, 135, 140, 143, 145, 145, 150, 150, 155, 156, 159, 165, 169, 170, 170, 174, 175, 175, 182, 183, 185, 185, 187, 190, 195, 195
Offset: 1

Views

Author

Felix Huber, Aug 13 2025

Keywords

Comments

In the form (u^2 - v^2, 2*u*v, u^2 + v^2), u^2 + v^2) is the hypotenuse, max(u^2 - v^2, 2*u*v) is the long leg and min(u^2 - v^2, 2*u*v) is the short leg.
A101930(n) gives the total number of Pythagorean triples <= 10^n. The percentage of triangles in this sequence increases continuously:
number of terms <= h total number of
h in this sequence hypotenuses <= h percentage
10 0 2 0.0 %
100 21 52 40.4 %
1000 514 881 58.3 %
10000 8629 12471 69.2 %
100000 122431 161436 75.8 %

Examples

			The Pythagorean triple (9, 12, 15) does not have the form (u^2 - v^2, 2*u*v, u^2 + v^2), because 15 is not a sum of two nonzero squares. Therefore 15 is a term.
		

Crossrefs

Programs

  • Maple
    A386307:=proc(N) # To get all hypotenuses <= N
        local i,l,m,u,v,r,x,y,z;
        l:={};
        m:={};
        for u from 2 to floor(sqrt(N-1)) do
            for v to min(u-1,floor(sqrt(N-u^2))) do
                x:=min(2*u*v,u^2-v^2);
                y:=max(2*u*v,u^2-v^2);
                z:=u^2+v^2;
                m:=m union {[z,y,x]};
                if gcd(u,v)=1 and is(u-v,odd) then
                    l:=l union {seq([i*z,i*y,i*x],i=1..N/z)}
                fi
            od
        od;
        r:=l minus m;
        return seq(r[i,1],i=1..nops(r));
    end proc;
    A386307(1000);

Formula

a(n) = sqrt(A386308(n)^2 + A386309(n)^2).
{A009000(n)} = {a(n)} union {A020882(n)} union {A386943(n)}.

A386943 Ordered hypotenuses of nonprimitive Pythagorean triples of the form (u^2 - v^2, 2*u*v, u^2 + v^2), where u and v are positive integers.

Original entry on oeis.org

10, 20, 26, 34, 40, 45, 50, 52, 58, 68, 74, 80, 82, 90, 100, 104, 106, 116, 117, 122, 125, 130, 130, 136, 146, 148, 153, 160, 164, 170, 170, 178, 180, 194, 200, 202, 208, 212, 218, 225, 226, 232, 234, 244, 245, 250, 250, 260, 260, 261, 272, 274, 290, 290, 292, 296
Offset: 1

Views

Author

Felix Huber, Aug 24 2025

Keywords

Comments

In the form (u^2 - v^2, 2*u*v, u^2 + v^2), u^2 + v^2 is the hypotenuse, max(u^2 - v^2, 2*u*v) is the long leg and min(u^2 - v^2, 2*u*v) is the short leg.
A101930(n) gives the total number of Pythagorean triples <= 10^n.
number of terms <= h total number of
h in this sequence hypotenuses <= h percentage
10 1 2 50.0 %
100 15 52 28.8 %
1000 209 881 23.7 %
10000 2249 12471 18.0 %
100000 23086 161436 14.3 %

Examples

			The nonprimitive Pythagorean triple (6, 8, 10) is of the form (u^2 - v^2, 2*u*v, u^2 + v^2): From u = 3 and v = 1 follows u^2 - v^2 = 8 (long leg), 2*u*v = 6 (short leg), u^2 - v^2 = 10 (hypotenuse). Therefore, 10 is a term.
		

Crossrefs

Programs

  • Maple
    A386943:=proc(N) # To get all hypotenuses <= N
        local i,l,u,v;
        l:=[];
        for u from 2 to floor(sqrt(N-1)) do
            for v to min(u-1,floor(sqrt(N-u^2))) do
                if gcd(u,v)>1 or is(u-v,even) then
                    l:=[op(l),[u^2+v^2,max(2*u*v,u^2-v^2),min(2*u*v,u^2-v^2)]]
                fi
            od
        od;
        l:=sort(l);
        return seq(l[i,1],i=1..nops(l));
    end proc;
    A386943(296);

Formula

a(n) = sqrt(A386944(n)^2 + A386945(n)^2).
{A009000(n)} = {a(n)} union {A020882(n)} union {A386307(n)}.

A108707 Minimum side in Pythagorean triangles with hypotenuse of n.

Original entry on oeis.org

0, 0, 0, 0, 3, 0, 0, 0, 0, 6, 0, 0, 5, 0, 9, 0, 8, 0, 0, 12, 0, 0, 0, 0, 7, 10, 0, 0, 20, 18, 0, 0, 0, 16, 21, 0, 12, 0, 15, 24, 9, 0, 0, 0, 27, 0, 0, 0, 0, 14, 24, 20, 28, 0, 33, 0, 0, 40, 0, 36, 11, 0, 0, 0, 16, 0, 0, 32, 0, 42, 0, 0, 48, 24, 21, 0, 0, 30, 0, 48, 0, 18, 0, 0, 13, 0, 60, 0, 39, 54
Offset: 1

Views

Author

Sébastien Dumortier, Jun 20 2005

Keywords

Examples

			a(5) = 3 as the right triangle with sides (3, 4, 5) has hypotenuse n = 5 smallest side a(5) = 3. This is the smallest side a right triangle with integer sides and hypotenuse 5 can have. - _David A. Corneth_, Apr 10 2021
		

Crossrefs

A046080 gives the number of Pythagorean triangles with hypotenuse n.

Programs

  • Mathematica
    f[n_]:=Block[{k=n-1,m=Sqrt[n/2],a},While[k>m&&!IntegerQ[(a=Sqrt[n^2-k^2])],k--];If[k<=m,0,a]];Table[f[n],{n,90}]
  • PARI
    first(n) = {my(lh = List(), res = vector(n, i, oo)); for(u = 2, sqrtint(n), for(v = 1, u, if (u^2+v^2 > n, break); if ((gcd(u, v) == 1) && (0 != (u-v)%2), for (i = 1, n, if (i*(u^2+v^2) > n, break); listput(lh, i*(u^2+v^2)); res[i*(u^2+v^2)] = vecmin([res[i*(u^2+v^2)], i*(u^2 - v^2), i*2*u*v]))))); for(i = 1, n, if(res[i] == oo, res[i] = 0)); res } \\ David A. Corneth, Apr 10 2021, adapted from A009000

Extensions

Extended by Ray Chandler, Dec 20 2011

A108708 Maximum side length in Pythagorean triangles with hypotenuse n.

Original entry on oeis.org

0, 0, 0, 0, 4, 0, 0, 0, 0, 8, 0, 0, 12, 0, 12, 0, 15, 0, 0, 16, 0, 0, 0, 0, 24, 24, 0, 0, 21, 24, 0, 0, 0, 30, 28, 0, 35, 0, 36, 32, 40, 0, 0, 0, 36, 0, 0, 0, 0, 48, 45, 48, 45, 0, 44, 0, 0, 42, 0, 48, 60, 0, 0, 0, 63, 0, 0, 60, 0, 56, 0, 0, 55, 70, 72, 0, 0, 72, 0, 64, 0, 80, 0, 0, 84, 0, 63, 0
Offset: 1

Views

Author

Sébastien Dumortier, Jun 20 2005

Keywords

Examples

			a(5) is 4 as the maximum side (other than the hypotenuse) a right triangle with integer sides and hypotenuse 5 can have.
		

Crossrefs

A046080 gives the number of Pythagorean triangles with hypotenuse n.

Programs

  • Mathematica
    f[n_] := Block[{k = n - 1, m = Sqrt[n/2]}, While[k > m && !IntegerQ[Sqrt[n^2 - k^2]], k-- ]; If[k <= m, 0, k]]; Table[ f[n], {n, 90}] (* Robert G. Wilson v, Jun 21 2005 *)
  • PARI
    first(n) = {my(lh = List(), res = vector(n)); for(u = 2, sqrtint(n), for(v = 1, u, if (u^2+v^2 > n, break); if ((gcd(u, v) == 1) && (0 != (u-v)%2), for (i = 1, n, if (i*(u^2+v^2) > n, break); listput(lh, i*(u^2+v^2)); res[i*(u^2+v^2)] = max(res[i*(u^2+v^2)], max(i*(u^2 - v^2), i*2*u*v)); ); ); ); ); for(i = 1, n, if(res[i] == oo, res[i] = 0)); res } \\ David A. Corneth, Apr 10 2021, adapted from A009000

Extensions

More terms from Robert G. Wilson v, Jun 21 2005

A136346 Octagonal numbers which are the sums of exactly two positive octagonal numbers.

Original entry on oeis.org

560, 736, 1541, 3201, 5461, 6816, 7400, 9976, 11041, 11408, 13333, 14981, 15408, 15841, 19521, 21000, 21505, 25761, 28616, 30401, 41536, 45141, 50440, 51221, 52008, 54405, 56856, 61920, 63656, 65416, 69008, 75525, 76480, 81345, 82336, 85345, 87381, 89441
Offset: 1

Views

Author

Jonathan Vos Post, Dec 25 2007

Keywords

Comments

For sums of two positive octagonal numbers, see A136345. This is to octagonal numbers A000567 as A089982 is to triangular numbers A000217, as A009000 is to squares A000290, as A136117 is to pentagonal numbers A000326, as A133215 is to hexagonal numbers A000384, and as A117104 is to heptagonal numbers A000566. If Oc(a) + Oc(b) = Oc(c) then a(3a-2) + b(3b+2) = c(3c+2), so solving the quadratic equations for c we have (when an integer): c = (2 + sqrt(4 + 36a^2 + 36b^2 - 24a - 24b))/6.

Examples

			Where Oc(n) = A000567(n) = n-th octagonal number:
a(1) = 560 = Oc(14) = 280 + 280 = Oc(10) + Oc(10).
a(2) = 736 = Oc(16) = 560 + 176 = Oc(14) + Oc(8).
a(3) = 1541 = Oc(23) = 1408 + 133 = Oc(22) + Oc(7).
a(4) = 3201 = Oc(33) = 2465 + 736 = Oc(29) + Oc(16).
a(5) = 5461 = Oc(43) = 2821 + 2640 = Oc(31) + Oc(30).
		

Crossrefs

Programs

  • Mathematica
    Module[{nn=300,ono},ono=PolygonalNumber[8,Range[nn]];Union[Select[ Total/@ Tuples[ono,2],MemberQ[ono,#]&]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 26 2019 *)

Formula

A000567 INTERSECTION {A000567(i) + A000567(j), i, j > 0}. {i*(3*i-2)} INTERSECTION {i*(3*i-2) + j(3*j-2), i > 0}.

Extensions

Corrected and edited by B. D. Swan (bdswan(AT)gmail.com), Dec 20 2008

A307448 List of pairs of coordinates (x,y) of the visited points for a self-avoiding walk with an incrementing step length confined to one quadrant of a 2D plane where at each step the walk must go to an unvisited point with integer coordinates as close as possible to the origin.

Original entry on oeis.org

0, 0, 0, 1, 2, 1, 2, 4, 2, 0, 2, 5, 8, 5, 1, 5, 9, 5, 0, 5, 10, 5, 10, 16, 10, 4, 5, 16, 5, 2, 5, 17, 5, 1, 5, 18, 5, 0, 5, 19, 17, 3, 17, 24, 17, 2, 17, 25, 17, 1, 2, 21, 26, 11, 26, 38, 26, 10, 5, 30, 23, 6, 23, 37, 23, 5, 23, 38, 7, 8, 42, 8, 6, 8, 43, 8, 5, 8, 44, 8, 4, 8, 45, 8, 3, 8, 46, 8, 2, 8, 47
Offset: 1

Views

Author

Scott R. Shannon, Aug 09 2019

Keywords

Comments

Consider a walk on a 2D plane starting at the (0,0) origin which is confined to the positive x and y quadrant, i.e., x >= 0, y >= 0. We introduce the following rules for the walk: 1. The step length, initially 1, increments by 1 after each step. 2. The walk can only step to grid points with integer x and y coordinates. 3. The walk cannot go to a grid point already visited, nor can it backtrack on its very first step from the origin. 4. At each step the walk must always go to a point which is as close as possible to the origin. Given these rules, and a first step of length 1 to (0,1), this sequence gives the (x,y) coordinate points that are visited by the walk.
The sequence has 33305 pairs of coordinates. On the 33304th step the walk visits point (498,498) and now two points, (33803,498) and (498,33803), are both unvisited and available for the next step, thus beyond this point the walk/sequence is not uniquely defined.
For step lengths > 100 the closest approach to the origin is at step 2032 which visits point (6,0). The smallest ratio of distance-to-origin to step length occurs at step 27628 which visits point (7,15). The largest visited x and y coordinates are 42165 and 38631 respectively.
One finds there are long lines of adjacent visited points, differing by two step lengths, which are due to the path moving outward and then back inward along the x and y axial directions. These continue until the innermost point encounters an axis or a Pythagorean diagonal step is found which is closer to the origin. These adjacent points are equivalent to the points forming the 'concentric circles' of the Recamán sequence A005132 when plotted as a spiral. There is also a general clustering of the points towards the axis as well as the y=x diagonal.
This sequence raises the question - is there a walk that ultimately returns to the origin? Currently this is unknown. Beyond the 33304th point a recursive search must be perform on each branching path. Investigating beyond the first branching point show that the next branch occurs at step 200477, at point (121959,121959), followed by a series of branches at step lengths 472952, 730405, 974413.

Examples

			The first 12 steps are along the x-y axial directions. But on the 13th step the point (5,16) is available and the closest possible to the origin - this is visited by stepping along the hypotenuse of a (5,12,13) Pythagorean triangle from the point (10,4).
		

Crossrefs

A347595 a(0) = 1; for n>0, a(n) is the smallest positive integer that has not previously occurred such that a(n-1)^2 + n^2 + a(n) is a square.

Original entry on oeis.org

1, 2, 8, 27, 39, 54, 73, 98, 133, 186, 273, 426, 709, 1250, 2305, 4386, 8517, 16746, 33169, 65978, 131557, 262674, 524865, 1049202, 2097829, 4195034, 8389393, 16778058, 33555333, 67109826, 134218753, 268436546, 536872069, 1073743050, 2147484945, 4294968666, 8589936037, 17179870706
Offset: 0

Views

Author

Scott R. Shannon, Sep 08 2021

Keywords

Comments

This sequence uses the same rules as A347594 except here all numbers must be unique. Up to 10^5 terms all terms are larger than the previous term; it is unknown if this holds for all terms as n->infinity.

Examples

			a(1) = 2 as a(0)^2 + 1^2 = 1 + 1 = 2, and 2 + 2 = 4 = 2^2 is the next smallest square.
a(2) = 8 as a(1)^2 + 2^2 = 4 + 4 = 8, and 8 + 8 = 16 = 4^2. Note that although 8 + 1 = 9 = 3^2, 1 cannot be chosen as a(0) = 1.
a(3) = 27 as a(2)^2 + 3^2 = 64 + 9 = 73 and 73 + 27 = 100 = 10^2.  Note that although 73 + 8 = 81 = 9^2, 8 cannot be chosen as a(2) = 8.
a(4) = 39 as a(3)^2 + 4^2 = 729 + 16 = 745, and 745 + 39 = 784 = 28^2 is the next smallest square.
		

Crossrefs

A349119 a(0) = 1; for n>0, a(n) is the smallest positive integer that has not previously occurred such that |n - a(n-1)| + a(n) is a square.

Original entry on oeis.org

1, 4, 2, 3, 8, 6, 9, 7, 15, 10, 16, 11, 24, 5, 27, 13, 22, 20, 14, 31, 25, 12, 26, 33, 40, 21, 44, 19, 55, 23, 18, 36, 32, 35, 48, 51, 34, 46, 17, 42, 47, 30, 37, 43, 63, 82, 28, 45, 61, 52, 62, 38, 50, 78, 57, 79, 41, 65, 29, 70, 39, 59, 97, 66, 98, 67, 80, 68, 49, 101, 69, 119, 53, 124, 71, 60
Offset: 0

Views

Author

Scott R. Shannon, Nov 08 2021

Keywords

Examples

			a(1) = 4 as |1 - a(0)| = |1 - 1| = 0, and 0 + 4 = 4 = 2^2 is the next smallest square. Note a(1) cannot be 1 as a(0) = 1.
a(4) = 8 as |4 - a(3)| = |4 - 3| = 1, and 1 + 8 = 9 = 3^2 is the next smallest square. Note a(4) cannot be 3 as a(3) = 3.
a(8) = 15 as |8 - a(7)| = |8 - 7| = 1, and 1 + 15 = 16 = 4^2 is the next smallest square. Note a(8) cannot be 3 or 8 as these have previously occurred.
		

Crossrefs

A349182 a(0) = 1; for n>0, a(n) is the smallest positive integer such that |n - a(n-1)| + a(n) is a square.

Original entry on oeis.org

1, 1, 3, 1, 1, 5, 3, 5, 1, 1, 7, 5, 2, 5, 7, 1, 1, 9, 7, 4, 9, 4, 7, 9, 1, 1, 11, 9, 6, 2, 8, 2, 6, 9, 11, 1, 1, 13, 11, 8, 4, 12, 6, 12, 4, 8, 11, 13, 1, 1, 15, 13, 10, 6, 1, 10, 3, 10, 1, 6, 10, 13, 15, 1, 1, 17, 15, 12, 8, 3, 14, 7, 16, 7, 14, 3, 8, 12, 15, 17, 1, 1, 19, 17, 14, 10, 5, 18, 11
Offset: 0

Views

Author

Scott R. Shannon, Nov 09 2021

Keywords

Examples

			a(1) = 1 as |1 - a(0)| = |1 - 1| = 0, and 0 + 1 = 1 = 1^2 is the next smallest square.
a(2) = 3 as |2 - a(1)| = |2 - 1| = 1, and 1 + 3 = 4 = 2^2 is the next smallest square.
a(5) = 5 as |5 - a(4)| = |5 - 1| = 4, and 4 + 5 = 9 = 3^2 is the next smallest square.
		

Crossrefs

Programs

  • Mathematica
    nxt[{n_,a_}]:={n+1,Module[{k=1},While[!IntegerQ[Sqrt[(Abs[n+1-a])+k]],k++];k]}; NestList[ nxt,{0,1},90][[;;,2]] (* Harvey P. Dale, Aug 20 2024 *)
Previous Showing 21-30 of 40 results. Next