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 11-20 of 27 results. Next

A360173 Irregular triangle (an infinite binary tree) read by rows. The tree has root node 0, in row n=0. Each node then has left child m - n if nonnegative and right child m + n. Where m is the value of the parent node and n is the row of the children.

Original entry on oeis.org

0, 1, 3, 0, 6, 4, 2, 10, 9, 7, 5, 15, 3, 15, 1, 13, 11, 9, 21, 10, 8, 22, 8, 6, 20, 4, 18, 2, 16, 14, 28, 2, 18, 0, 16, 14, 30, 0, 16, 14, 12, 28, 12, 10, 26, 10, 8, 24, 6, 22, 20, 36, 11, 9, 27, 9, 7, 25, 5, 23, 21, 39, 9, 7, 25, 5, 23, 3, 21, 19, 37, 3, 21
Offset: 0

Views

Author

John Tyler Rascoe, Jan 28 2023

Keywords

Comments

A node will have a left child only if the value of that child is greater than or equal to 0. But, each node will have a right child, since adding n will always be greater than 0.
The n-th row will have A141002(n) nodes. The leftmost border is A008344 and the rightmost is A000217.

Examples

			The binary tree starts with root 0 in row n = 0. In row n = 3, the parent node m = 3 has the first left child since 3 - 3 >= 0.
The tree begins:
row
[n]
[0]           0
               \
[1]             1
                 \
[2]            ___3___
              /       \
             /         \
[3]         0         __6__
             \       /     \
[4]           4     2      10
               \     \    /  \
[5]             9     7  5    15
		

Crossrefs

Row sums give A360229.

Programs

  • Maple
    T:= proc(n) option remember; `if`(n=0, 0, map(x->
          [`if`(xAlois P. Heinz, Jan 30 2023
  • Mathematica
    row[n_] := Module[{r = {0}}, For[h = 1, h <= n, h++, r = Flatten[If[#-h >= 0, {#-h, #+h}, {#+h}]& /@ r]]; r];
    Table[row[n], {n, 0, 10}] // Flatten (* Jean-François Alcover, Apr 16 2025, after Rémy Sigrist *)
  • PARI
    row(n) = { my (r=[0]); for (h=1, n, r=concat(apply(v->if (v-h>=0, [v-h,v+h], [v+h]), r))); return (r) } \\ Rémy Sigrist, Jan 31 2023
  • Python
    def A360173_rowlist(row_n):
        A = [[0]]
        for i in range(0,row_n):
            A.append([])
            for j in range(0,len(A[i])):
                x = A[i][j]
                if x - i -1 >= 0:
                    A[i+1].append(x-i-1)
                if x + i + 1 >= 0:
                    A[i+1].append(x+i+1)
        return(A)
    

A008345 a(n+1) = a(n)-b(n+1) if a(n) >= b(n+1) else a(n)+b(n+1), where {b(n)} are the triangular numbers A000217.

Original entry on oeis.org

0, 1, 4, 10, 0, 15, 36, 8, 44, 89, 34, 100, 22, 113, 8, 128, 264, 111, 282, 92, 302, 71, 324, 48, 348, 23, 374, 752, 346, 781, 316, 812, 284, 845, 250, 880, 214, 917, 176, 956, 136, 997, 94, 1040, 50, 1085, 4, 1132, 2308, 1083, 2358, 1032, 2410, 979, 2464, 924
Offset: 0

Views

Author

Keywords

Comments

a(0) and a(4) are both zero. Are there any other zero values? - N. J. A. Sloane, Sep 12 2019

Crossrefs

Programs

  • Maple
    A008345 := proc(n) option remember; if n = 1 then n-1 elif A008345(n-1) >= n*(n+1)/2 then A008345(n-1)-n*(n+1)/2 else A008345(n-1)+n*(n+1)/2; fi; end;
  • Mathematica
    nxt[{n_,a_}]:=Module[{tr=((n+1)(n+2))/2},{n+1,If[a>=tr,a-tr,a+tr]}]; Transpose[NestList[nxt,{0,0},50]][[2]] (* Harvey P. Dale, Jun 19 2013 *)

A047415 Numbers that are congruent to {1, 3, 4, 6} mod 8.

Original entry on oeis.org

1, 3, 4, 6, 9, 11, 12, 14, 17, 19, 20, 22, 25, 27, 28, 30, 33, 35, 36, 38, 41, 43, 44, 46, 49, 51, 52, 54, 57, 59, 60, 62, 65, 67, 68, 70, 73, 75, 76, 78, 81, 83, 84, 86, 89, 91, 92, 94, 97, 99, 100, 102, 105, 107, 108, 110, 113, 115, 116, 118, 121, 123, 124
Offset: 1

Views

Author

Keywords

Comments

Consider an operation SS(n) defined for a specific sequence b where b(n) is the n-th term of b. This operation is defined as follows: SS(1) = b(1); if b(n+1) > SS(n), SS(n+1) = SS(n) + b(n+1), otherwise SS(n+1) = SS(n) - b(n+1) (If b(n) = A000027(n), then SS(n) = A008344(n+1)). If the sequence b can represent any permutation of the first n natural numbers, then a(n) is the maximum possible value of SS(n). - Iain Fox, Sep 15 2020 (see link by Math StackExchage)

Crossrefs

Programs

Formula

G.f.: x*(1+x+2*x^3) / ( (1+x^2)*(x-1)^2 ). - R. J. Mathar, Oct 08 2011
a(n) = 2*(n-1)-(i^(n*(n+1))-1)/2, where i=sqrt(-1). - Bruno Berselli, Dec 06 2011
From Wesley Ivan Hurt, May 31 2016: (Start)
a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) for n>4.
a(n) = (1+i)*(4*n-4*n*i+3*i-3+i^(1-n)-i^n)/4 where i=sqrt(-1).
a(2*k) = A047398(k), a(2*k-1) = A047461(k). (End)
E.g.f.: (4 + sin(x) - cos(x) + (4*x - 3)*exp(x))/2. - Ilya Gutkovskiy, May 31 2016
Sum_{n>=1} (-1)^(n+1)/a(n) = 3*Pi/16 - (sqrt(2)+1)*log(2)/8 + sqrt(2)*log(sqrt(2)+2)/4. - Amiram Eldar, Dec 24 2021

A086283 a(1)=1, a(2)=1 and, for n>2, a(n) is the smallest positive integer such that the sequence of second order absolute difference is the sequence of positive integers {1,2,3,4,...}.

Original entry on oeis.org

1, 1, 2, 5, 5, 1, 10, 7, 17, 15, 4, 3, 15, 15, 2, 29, 17, 45, 34, 5, 15, 45, 36, 5, 13, 45, 38, 5, 11, 45, 40, 5, 1, 37, 34, 71, 69, 31, 30, 69, 69, 29, 110, 71, 153, 27, 108, 73, 155, 25, 106, 75, 157, 23, 104, 77, 159, 21, 102, 79, 161, 19, 100, 81, 163, 17, 98, 83, 1, 15, 98
Offset: 1

Views

Author

John W. Layman, Aug 28 2003

Keywords

Comments

A085059 is the smallest positive sequence such that the first order absolute difference is {1,2,3,4,...}. Other related sequences may be found by searching for the words "absolute difference" with the "Lookup" facility.

Examples

			For the initial terms, no smaller positive terms work than
Sequence {a(n)}: 1,1,2,5,5,1,10,7,17,15,4,3,...
First absolute difference: 0,1,3,0,4,9,3,10,2,11,1,...
Second absolute difference: 1,2,3,4,5,6,7,8,9,10,...
		

Crossrefs

Cf. A085059.
Cf. A008344 (absolute differences).

Programs

  • Haskell
    a086283 n = x086283_list !! (n-1)
    a086283_list = 1 : 1 : f 1 0 [1..] where
       f x y (z:zs) = u : f u (abs $ x - u) zs where
         u = minimum [if v < x then x - v else x + v |
                      v <- if y < z then [y + z] else [y + z, y - z]]
    -- Reinhard Zumkeller, Oct 17 2014

A088230 a(1)=0; for n>1: a(n)=a(n-1)-n if that number is nonnegative and occurs at most once in the sequence, otherwise a(n)=a(n-1)+n.

Original entry on oeis.org

0, 1, 3, 0, 4, 9, 3, 10, 2, 11, 1, 12, 24, 11, 25, 10, 26, 9, 27, 8, 28, 7, 29, 6, 30, 5, 31, 4, 32, 61, 31, 62, 30, 63, 29, 64, 28, 65, 27, 66, 26, 67, 25, 68, 24, 69, 23, 70, 22, 71, 21, 72, 20, 73, 19, 74, 18, 75, 17, 76, 16, 77, 15, 78, 14, 79, 13, 80, 12, 81, 151, 80, 8, 81
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 03 2003

Keywords

Crossrefs

Programs

  • Haskell
    a088230 n = a088230_list !! (n-1)
    a088230_list = 0 : f [1..] [0] where
       f (x:xs) ys@(y:_)
        | x <= y && (length $ filter (== z) ys) <= 1 = z : f xs (z : ys)
        | otherwise = (x + y) : f xs ((x + y) : ys)  where z = y - x
    -- Reinhard Zumkeller, May 08 2012

A091068 a(0) = 0; for n>0, a(n) = a(n-1) - n if that is >= 0, else a(n) = a(n-1) + n - 1.

Original entry on oeis.org

0, 0, 1, 3, 6, 1, 6, 12, 4, 12, 2, 12, 0, 12, 25, 10, 25, 8, 25, 6, 25, 4, 25, 2, 25, 0, 25, 51, 23, 51, 21, 51, 19, 51, 17, 51, 15, 51, 13, 51, 11, 51, 9, 51, 7, 51, 5, 51, 3, 51, 1, 51, 102, 49, 102, 47, 102, 45, 102, 43, 102, 41, 102, 39, 102, 37, 102, 35, 102, 33
Offset: 0

Views

Author

N. J. A. Sloane, Feb 23 2004

Keywords

Comments

A sequence equivalent to A091023. Let b(k) = A091023(k) for all k. Suppose we have just assigned b(x) = n. Then a(n-1) is the number of b(k) for 1 <= k < x that are not yet assigned.

Examples

			a(4) = 6, 6-5 = 1 >= 0, so a(5) = 1. 1-6 < 0, so a(6) = 1 + 5 = 6.
When in A091023 we assign b(8) = 11, there are 2 unassigned b's to the left, namely b(3) and b(6) and indeed a(10) = 2.
		

Crossrefs

Programs

  • Mathematica
    t={0};Do[AppendTo[t,If[t[[-1]]-n>=0,t[[-1]]-n,t[[-1]]+n-1]],{n,1,69}];t (* Indranil Ghosh, Feb 22 2017 *)
    nxt[{n_,a_}]:={n+1,If[a-n-1>=0,a-n-1,a+n]}; NestList[nxt,{0,0},70][[;;,2]] (* Harvey P. Dale, Jun 14 2023 *)
  • Python
    print("0 0")
    i=1
    a=0
    if a-i>=0:b=a-i
    else:b=a+i-1
    while i<=100:
        print(str(i)+" "+str(b))
        a=b
        i+=1
        if a-i>=0:b=a-i
        else:b=a+i-1 # Indranil Ghosh, Feb 22 2017

Formula

This is a concatenation of blocks: b(-2) = [0], b(-1) = [0], b(0) = [1], b(1) = [3], b(2) = [6 1 6], b(3) = [12 4 12 2 12 0 12], b(4) = [25 10 25 8 25 6 25 4 25 2 25 0 25], ...
Let M(k) be the k-th term of A077854. Then block b(k) for k >= 2 is [M(k), x, M(k), x-2, M(k), x-4, M(k), ..., M(k), 0 or 1, M(k)] where x = M(k-1) - 2. The length of the block is M(k+1) - 2 M(k) + M(k-1) (the second difference of A077854, shifted one place).

A111466 a(1) = 1, a(n+1) = a(n) - F(n+1), if F(n+1) <= a(n), else a(n+1) = a(n) + F(n+1). F(n) is the n-th Fibonacci number (A000045).

Original entry on oeis.org

1, 0, 2, 5, 0, 8, 21, 0, 34, 89, 0, 144, 377, 0, 610, 1597, 0, 2584, 6765, 0, 10946, 28657, 0, 46368, 121393, 0, 196418, 514229, 0, 832040, 2178309, 0, 3524578, 9227465, 0, 14930352, 39088169, 0, 63245986, 165580141, 0, 267914296, 701408733, 0, 1134903170
Offset: 1

Views

Author

Amarnath Murthy, Aug 05 2005

Keywords

Crossrefs

Programs

  • Maple
    with(combinat): a[1]:=1: for n from 1 to 50 do if fibonacci(n+1)<=a[n] then a[n+1]:=a[n]-fibonacci(n+1) else a[n+1]:=a[n]+fibonacci(n+1) fi od: seq(a[n],n=1..51); # Emeric Deutsch, Aug 11 2005
  • Mathematica
    nxt[{n_,a_}]:=Module[{fib=Fibonacci[n+1]},{n+1,If[fib<=a,a-fib,a+fib]}]; Transpose[NestList[nxt,{1,1},50]][[2]] (* Harvey P. Dale, Nov 21 2012 *)

Formula

a(3n+2) =0, a(3n) = F(3n), a(3n+1) = F(3n+2).
G.f.: -x*(1+2*x^2+x^3) / ( (x^2+x-1)*(x^4-x^3+2*x^2+x+1) ). - R. J. Mathar, Jun 23 2014

Extensions

More terms from Emeric Deutsch, Aug 11 2005

A309222 a(0) = 6; thereafter a(n) = a(n-1) + prime(n) if prime(n) > a(n-1), otherwise a(n) = a(n-1) - prime(n).

Original entry on oeis.org

6, 4, 1, 6, 13, 2, 15, 32, 13, 36, 7, 38, 1, 42, 85, 38, 91, 32, 93, 26, 97, 24, 103, 20, 109, 12, 113, 10, 117, 8, 121, 248, 117, 254, 115, 264, 113, 270, 107, 274, 101, 280, 99, 290, 97, 294, 95, 306, 83, 310, 81, 314, 75, 316, 65, 322, 59, 328, 57, 334, 53, 336, 43, 350, 39, 352
Offset: 0

Views

Author

N. J. A. Sloane, Aug 29 2019

Keywords

Comments

Hugo van der Sanden asks if this ever reaches 0. He finds that a(n) > 0 for n < 5*10^10. Probabilistic arguments suggest it will never reach 0.

References

  • Hugo van der Sanden, Posting to Sequence Fans Mailing List, Aug 28 2019

Crossrefs

If we start with 0 or 1 instead of 6 we get A008348, A022837.
Similar in spirit to A008344, and has a similar graph.

A309225 Indices m such that A008348(m)=0.

Original entry on oeis.org

0, 3, 369019, 22877145
Offset: 1

Views

Author

N. J. A. Sloane, Aug 31 2019

Keywords

Comments

These terms given here are based on the comments in A008348 from Dmitry Kamenetsky.
Probably infinite, on probabilistic grounds, but this is an open question. (Comment modified by N. J. A. Sloane, Oct 03 2019.)

Crossrefs

A355072 a(0) = 0, a(1) = 1; for n > 1, a(n) is the smallest positive number whose sum a(n) + a(n-1) is distinct from all previous sums, a(i) + a(i-1), i=1..n-1, whose product a(n) * a(n-1) is distinct from all previous products, a(i) * a(i-1), i=1..n-1, and whose difference |a(n) - a(n-1)| is distinct from all previous differences, |a(i) - a(i-1)|, i=1..n-1.

Original entry on oeis.org

0, 1, 1, 3, 6, 1, 5, 11, 1, 9, 16, 1, 10, 21, 1, 13, 26, 1, 17, 3, 20, 1, 23, 5, 28, 1, 25, 46, 1, 29, 3, 32, 2, 34, 3, 37, 1, 40, 2, 42, 1, 44, 2, 46, 9, 42, 7, 53, 1, 49, 96, 2, 55, 4, 54, 103, 1, 61, 2, 59, 5, 60, 116, 1, 65, 2, 67, 1, 69, 7, 65, 126, 1, 72, 5, 74, 1, 73, 143, 1, 77, 3, 78, 155
Offset: 0

Views

Author

Scott R. Shannon, Jun 18 2022

Keywords

Comments

For n up to ~35000 the vast majority of terms are concentrated along three lines, the lowest being near the x-axes; see the first linked image. In this same range there are many terms equal to 1; see A355135. Beyond this range the terms no longer fall along the upper-most line and the number of terms equal to 1 greatly diminishes. The reason for this change in behavior is unknown. The remaining upper-most line has a gradient close to 1 and contains multiple fixed points; see A355136 and the second linked image. The sequence it conjectured to contain all the positive integers.

Examples

			a(3) = 3 as a(2) = 1 and 3+1 = 4, 3*1 = 3, |3-1| = 2, and this product, sum, and difference has not occurred previously.
a(5) = 1 as a(4) = 6 and 1+6 = 7, 1*6 = 6, |1-6| = 5, and this product, sum, and difference has not occurred previously.
		

Crossrefs

Previous Showing 11-20 of 27 results. Next