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.

A128218 First differences of A128217.

Original entry on oeis.org

1, 3, 1, 3, 1, 1, 5, 1, 1, 1, 5, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

John W. Layman, Feb 19 2007

Keywords

Comments

a(A130883(n-1)) = 2*n-1 and a(m) != 2*n-1 for m < A130883(n-1). - Reinhard Zumkeller, Jun 20 2015

Crossrefs

Cf. A128127.
Cf. A130883, A152271 (run lengths after initial term).

Programs

  • Haskell
    a128218 n = a128218_list !! (n-1)
    a128218_list = zipWith (-) (tail a128217_list) a128217_list
    -- Reinhard Zumkeller, Jun 20 2015
    
  • Mathematica
    nsrQ[n_]:=Module[{sr=Sqrt[n]},Abs[First[sr-Nearest[{Floor[sr], Ceiling[ sr]}, sr]]]<1/4];Differences[Select[Range[0,250],nsrQ]] (* Harvey P. Dale, May 02 2012 *)
  • PARI
    default(realprecision, 10000);
    is_A128217(n) = ((abs(sqrt(n)-sqrtint(n))<(1/4)) || (abs(sqrt(n)-(1+sqrtint(n)))<(1/4)));
    k=0; n=0; prevm=0; while(k<20000, n++; if(is_A128217(n), k++; write("b128218.txt", k, " ", (n-prevm)); prevm = n)); \\ Antti Karttunen, Jan 16 2025

Formula

Let A(1)={1}. Then, for k=2,3,4,..., form A(k) by appending to A(k-1) the term k-1 followed by k-1 1's, if k is even, or by appending to A(k-1) the term k followed by k-1 1's, if k is odd. {a(n)} appears to be the limit of {A(k)} as k->infinity.

Extensions

Offset changed by Reinhard Zumkeller, Jun 20 2015

A063656 Numbers k such that the truncated square root of k is equal to the rounded square root of k.

Original entry on oeis.org

0, 1, 2, 4, 5, 6, 9, 10, 11, 12, 16, 17, 18, 19, 20, 25, 26, 27, 28, 29, 30, 36, 37, 38, 39, 40, 41, 42, 49, 50, 51, 52, 53, 54, 55, 56, 64, 65, 66, 67, 68, 69, 70, 71, 72, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 121
Offset: 0

Views

Author

Floor van Lamoen, Jul 24 2001

Keywords

Comments

Also: take 1, skip 0, take 2, skip 1, take 3, skip 2, ...
The union of sets of numbers in closed intervals [k^2,k^2+k], k >= 0, intervals 0 to 1, 1 to 2, 4 to 6, 9 to 12 etc. - J. M. Bergot, Jun 27 2013
Conjecture: the following definition produces a(n) for n >= 1: a(1) = 1; for n > 1, smallest number > a(n-1) satisfying the condition that a(n) is a square if and only if n is a triangular number. - J. Lowell, May 13 2014
Thus a(2) = 2, because 2 is not a triangular number and not a square; a(3) != 3, because 3 is not a square but is a triangular number; a(3) = 4 is OK because 4 is a square and 3 is a triangular number; etc. [Examples supplied by N. J. A. Sloane, May 13 2014]

Examples

			The triangle begins as:
   0;
   1,  2;
   4,  5,  6;
   9, 10, 11, 12;
  16, 17, 18, 19, 20;
  25, 26, 27, 28, 29, 30;
  36, 37, 38, 39, 40, 41, 42;
  49, 50, 51, 52, 53, 54, 55, 56;
  ... - _Stefano Spezia_, Oct 19 2024
		

Crossrefs

Essentially partial sums of A051340.

Programs

  • Haskell
    a063656 n = a063656_list !! n
    a063656_list = f 1 [0..] where
       f k xs = us ++ f (k + 1) (drop (k - 1) vs) where
                        (us, vs) = splitAt k xs
    -- Reinhard Zumkeller, Jun 20 2015
  • Mathematica
    Select[Range[121],Floor[Sqrt[#]]==Round[Sqrt[#]] &] (* Stefano Spezia, Oct 19 2024 *)
  • PARI
    { n=-1; for (m=0, 10^9, if (sqrt(m)%1 < .5, write("b063656.txt", n++, " ", m); if (n==1000, break)) ) } \\ Harry J. Smith, Aug 27 2009
    

Formula

As a triangle from Stefano Spezia, Oct 19 2024: (Start)
T(n,k) = n^2 + k with 0 <= k <= n.
G.f.: x*(1 + x + 2*y - 4*x*y + 3*x^3*y^2 - x^2*y*(2 + y))/((1 - x)^3*(1 - x*y)^3). (End)

A220098 Manhattan distances between 2n and 1 in the double spiral with positive integers and 1 at the center.

Original entry on oeis.org

1, 2, 1, 2, 3, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 6, 7, 8, 9, 10, 11, 12, 13
Offset: 1

Views

Author

Alex Ratushnyak, Dec 04 2012

Keywords

Comments

Double spiral begins:
.
82---84---86---88---90---92---94---96---98
|
80 51---53---55---57---59---61---63---65
| | |
78 49 26---28---30---32---34---36 67
| | | | |
76 47 24 11---13---15---17 38 69
| | | | | | |
74 45 22 9 2----4 19 40 71
| | | | | | | | |
72 43 20 7 1 6 21 42 73
| | | | | | | | |
70 41 18 5----3 8 23 44 75
| | | | | | |
68 39 16---14---12---10 25 46 77
| | | | |
66 37---35---33---31---29---27 48 79
| | |
64---62---60---58---56---54---52---50 81
|
99---97---95---93---91---89---87---85---83

Examples

			From _Philippe Deléham_, Mar 08 2013: (Start)
As a square array, this begins:
  1,  1,  2,  2,  3,  3,  4,  4,  5, ...
  2,  3,  3,  4,  4,  5,  5,  6,  6, ...
  2,  4,  5,  5,  6,  6,  7,  7,  8, ...
  3,  4,  6,  7,  7,  8,  8,  9,  9, ...
  3,  5,  6,  8,  9,  9, 10, 10, 11, ...
  4,  5,  7,  8, 10, 11, 11, 12, 12, ...
  4,  6,  7,  9, 10, 12, 13, 13, 14, ...
  5,  6,  8,  9, 11, 12, 14, 15, 15, ..., etc.
As a triangle, this begins:
  1
  2, 1
  2, 3, 2
  3, 4, 3, 2
  3, 4, 5, 4, 3
  4, 5, 6, 5, 4, 3, etc. (End)
		

Crossrefs

Programs

  • C
    #include 
    #define SIZE 20
    int grid[SIZE][SIZE];
    int direction[] = {0, -1,  1, 0, 0, 1, -1, 0};
    main() {
      int i, j, x1, y1, x2, y2, stepSize;
      int direction1pos=0, direction2pos=4, val;
      x1 = y1 = x2 = y2 = SIZE/2;
      for (val=grid[y1][x1]=1, stepSize=0; ; ++stepSize) {
        if (x1<1 || x1>=SIZE-1 || x2<1 || x2>=SIZE-1) break;
        if (y1<1 || y1>=SIZE-1 || y2<1 || y2>=SIZE-1) break;
        for (i=stepSize|1; i; ++val,--i) {
          x1 += direction[direction1pos  ];
          y1 += direction[direction1pos+1];
          x2 += direction[direction2pos  ];
          y2 += direction[direction2pos+1];
          grid[y1][x1] = val*2;
          grid[y2][x2] = val*2+1;
          printf("%d, ",abs(x1-SIZE/2)+abs(y1-SIZE/2));
        }
        direction1pos = (direction1pos+2) & 7;
        direction2pos = (direction2pos+2) & 7;
      }
      for (i=0; i
    				
  • PARI
    step(v, m) = concat(v, vector(m, k, 1+v[#v-k+1]))
    a(max_n) = {my(v=[0], k=1); while(#v < max_n+1, v=step(v,k); k++); v[2..max_n+1]} \\ Thomas Scheuerle, Jan 07 2025
    
  • PARI
    A053615(n) = if(n<1, 0, sqrtint(n) - A053615(n - sqrtint(n)))
    a(n) = A053615(floor( floor( (sqrtint(n*8) + 1)/2 )^2/2 ) + n) \\ Thomas Scheuerle, Jan 07 2025

Formula

abs( a(n) - a(n-1) ) = 1.
From Thomas Scheuerle, Jan 07 2025: (Start)
a(n*(n+1)/2 - k) = 1 + a(n*(n-1)/2 + k) with a(0) = 0 and for 0 <= k < n.
a(n) = A053615(A128217(n+1)). (End)
Showing 1-3 of 3 results.