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

A330725 a(0) = 0; thereafter a(n) = a(n-1) + sigma(n) if sigma(n) > a(n-1), otherwise a(n) = a(n-1) - sigma(n), where sigma is the sum of divisors function A000203.

Original entry on oeis.org

0, 1, 4, 0, 7, 1, 13, 5, 20, 7, 25, 13, 41, 27, 3, 27, 58, 40, 1, 21, 63, 31, 67, 43, 103, 72, 30, 70, 14, 44, 116, 84, 21, 69, 15, 63, 154, 116, 56, 0, 90, 48, 144, 100, 16, 94, 22, 70, 194, 137, 44, 116, 18, 72, 192, 120, 0, 80, 170, 110, 278, 216, 120, 16
Offset: 0

Views

Author

Alois P. Heinz, Jan 11 2020

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0, ((s, t)-> s+
          `if`(s
    				
  • Mathematica
    nxt[{n_,a_}]:={n+1,If[DivisorSigma[1,n+1]>a,a+DivisorSigma[1,n+1],a- DivisorSigma[ 1,n+1]]}; NestList[nxt,{0,0},70][[All,2]] (* Harvey P. Dale, May 14 2022 *)

A331165 a(n) = a(n-1) + p(n) if p(n) > a(n-1), otherwise a(n) = a(n-1) - p(n), where p is the partition function A000041 (assuming a(n) = 0 for n < 0).

Original entry on oeis.org

1, 0, 2, 5, 0, 7, 18, 3, 25, 55, 13, 69, 146, 45, 180, 4, 235, 532, 147, 637, 10, 802, 1804, 549, 2124, 166, 2602, 5612, 1894, 6459, 855, 7697, 16046, 5903, 18213, 3330, 21307, 42944, 16929, 48114, 10776, 55359, 2185, 65446, 140621, 51487, 157045, 32291, 179564
Offset: 0

Views

Author

Alois P. Heinz, Jan 11 2020

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<0, 0, ((s, t)-> s+
         `if`(s
    				
  • Mathematica
    a[n_] := a[n] = If[n<0, 0, With[{a1 = a[n-1], p = PartitionsP[n]}, If[p>a1, a1 + p, a1 - p]]];
    a /@ Range[0, 70] (* Jean-François Alcover, Jan 05 2021 *)
  • PARI
    lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, my(p = numbpart(n-1)); va[n] = va[n-1] - p; if (va[n] < 0, va[n] += 2*p);); va;} \\ Michel Marcus, Jan 06 2021

A374318 For any n > 0, let b_n(n+1) = 0, and for k = 1..n, if b_n(k+1) >= k then b_n(k) = b_n(k+1) - k otherwise b_n(k) = b_n(k+1) + k; a(n) = b_n(1).

Original entry on oeis.org

0, 1, 1, 0, 2, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1
Offset: 0

Views

Author

Rémy Sigrist, Jul 04 2024

Keywords

Comments

This sequence is a variant of A008344; here we add or subtract by numbers from n down to 1, there by numbers from 1 up to n.
Apparently, the sequence only contains 0's, 1's and 2's.

Examples

			The first terms, alongside the corresponding sequences b_n, are:
  n   a(n)  b_n
  --  ----  ----------------------------------
   0     0  [0]
   1     1  [1, 0]
   2     1  [1, 2, 0]
   3     0  [0, 1, 3, 0]
   4     2  [2, 3, 1, 4, 0]
   5     1  [1, 2, 4, 1, 5, 0]
   6     1  [1, 0, 2, 5, 1, 6, 0]
   7     2  [2, 3, 5, 2, 6, 1, 7, 0]
   8     0  [0, 1, 3, 6, 2, 7, 1, 8, 0]
   9     1  [1, 2, 0, 3, 7, 2, 8, 1, 9, 0]
  10     1  [1, 2, 4, 7, 3, 8, 2, 9, 1, 10, 0]
		

Crossrefs

Programs

  • PARI
    a(n) = { my (b = 0); forstep (k = n, 1, -1, if (b >= k, b -= k, b += k);); return (b); }

Formula

Empirically, a(n) = 1 iff n belongs to A042963.

A117137 Same as triangle in A117136, but omit final 1 from each row.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Apr 21 2006

Keywords

Comments

Row n has length 2n+1.

Examples

			Triangle begins:
Row 0: 1
Row 1: 1 2 4
Row 2: 1 3 6 2 7
Row 3: 1 4 8 3 9 2 10
Row 4: 1 5 10 4 11 3 12 2 13
...
		

Crossrefs

The segments of A046901 appear as rows 2, 7, 22, 67, ... (A060816) of this array.

A329130 a(0)=0; for any n >= 0, if a(n) > n then a(n+1) = a(n) - n, otherwise a(n+1) = a(n) + k, where k is the total number of terms a(m) <= m with m <= n.

Original entry on oeis.org

0, 1, 3, 1, 4, 8, 3, 8, 1, 7, 14, 4, 12, 21, 8, 18, 3, 14, 26, 8, 21, 1, 15, 30, 7, 23, 40, 14, 32, 4, 23, 43, 12, 33, 55, 21, 44, 8, 32, 57, 18, 44, 3, 30, 58, 14, 43, 73, 26, 57, 8, 40, 73, 21, 55, 1, 36, 72, 15, 52, 90
Offset: 0

Views

Author

James Marjamaa, Nov 05 2019

Keywords

Comments

Values where a(n) = n appear to be the values of A027941.

Examples

			For n = 0,   a(0) =            0    0 >= a(0)
    n = 1,   a(1) = a(0) + 1 = 1,   1 >= a(1), I = 1
    n = 2,   a(2) = a(1) + 2 = 3,   2 <  a(2), I = 2
    n = 3,   a(3) = a(2) - 2 = 1,   3 >= a(3)
    n = 4,   a(4) = a(3) + 3 = 4,   4 >= a(4), I = 3
    n = 5,   a(5) = a(4) + 4 = 8,   5 <  a(5), I = 4
    n = 6,   a(6) = a(5) - 5 = 3,   6 >= a(6)
    n = 7,   a(7) = a(6) + 5 = 8,   7 <  a(7), I = 5
    n = 8,   a(8) = a(7) - 7 = 1,   8 >= a(8)
    n = 9,   a(9) = a(8) + 6 = 7,   9 >= a(9), I = 6
    n = 10,  a(10)= a(9) + 7 = 14,  10<  a(10), I = 7
    n = 11,  a(11)= a(10)- 10= 4,   11>= a(11)
    n = 12,  a(12)= a(11)+ 8 = 12,  12>= a(12), I = 8
    .
    .
    .
		

Crossrefs

Programs

  • C
    #include
    void seq(int terms)
    {int n = 0; int i = 0; int a = 0; int c = 0;
    while (n <= terms)
    {
        if (c)
           {int N = n - 1;
            a -= N;
            printf("%d\n", a);}
        else
           {a += i;
            printf("%d\n", a);
            i++;}
        if (a > n)
           {c = 1;}
        else
           {c = 0;}
        n++;
    }
    }
    int main(void)
    {
    seq(1000);
    }
    
  • PARI
    v=k=0; for (n=0, 69, print1 (v, ", "); v=if (v>n, v-n, v+k++)) \\ Rémy Sigrist, Nov 06 2019

Formula

a(n+1) = a(n) + I, if n >= a(n) ('I' is the next consecutive integer not yet added);
= a(n) - n, if n < a(n).
From Yan Sheng Ang, May 20 2020: (Start)
a(A004957(n)) = a(n). Hence it follows that (writing F(n) = A000045(n)):
a(F(2*n)-1) = F(2*n) for n > 1;
a(F(2*n)) = 1;
a(F(2*n+1)-1) = F(2*n+1)-1 (as noted above);
a(F(2*n+1)) = F(2*n+2);
a(F(2*n+1)+1) = F(2*n) for n > 1.
(End)

A357839 a(n) is the greatest divisor > 1 of n which has already been listed, otherwise a(n) is the smallest number not yet listed; a(1) = 0.

Original entry on oeis.org

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

Views

Author

Samuel Harkness, Oct 14 2022

Keywords

Comments

When n is prime, a(n) is the prime index (A000720).

Examples

			For n = 6 the set of all divisors of 6 greater than 1 is {2, 3, 6}. Also, the set of all a(n < 6) is {0, 1, 2, 3}. The greatest divisor of 6 (excluding 1) that has been listed is 3, so a(6) = 3.
		

Crossrefs

Programs

  • Mathematica
    a = 0; A = {a}; Do[s = Drop[Reverse[Divisors[n]], 1]; s = Drop[s, -1]; If[Length[s] >= 1, Do[If[MemberQ[A, Part[s, d]], AppendTo[A, Part[s, d]]; Break[]], {d, 1, Length[s]}], a++; AppendTo[A, a]], {n, 2, 77}] Print[A]
  • PARI
    first(n)=my(v=vector(n),m); forfactored(k=2,n, v[k[1]]=if(vecsum(k[2][,2])==1, m++, my(t); fordiv(k,d, if(d<=m, t=d)); t)); v \\ Charles R Greathouse IV, Oct 14 2022

A363653 a(1) = 1; for n > 1, a(n) = a(n-1) - A000005(n) if a(n) strictly positive, else a(n) = a(n-1) + A000005(n).

Original entry on oeis.org

1, 3, 1, 4, 2, 6, 4, 8, 5, 1, 3, 9, 7, 3, 7, 2, 4, 10, 8, 2, 6, 2, 4, 12, 9, 5, 1, 7, 5, 13, 11, 5, 1, 5, 1, 10, 8, 4, 8, 16, 14, 6, 4, 10, 4, 8, 6, 16, 13, 7, 3, 9, 7, 15, 11, 3, 7, 3, 1, 13, 11, 7, 1, 8, 4, 12, 10, 4, 8, 16, 14, 2, 4, 8, 2, 8, 4, 12, 10, 20, 15, 11, 9, 21
Offset: 1

Views

Author

Ctibor O. Zizka, Jun 13 2023

Keywords

Comments

Variation on Recamán's sequence A005132.

Examples

			a(1) = 1
a(2) = 1 + A000005(2) = 3
		

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = Module[{d = DivisorSigma[0, n]}, If[a[n - 1] > d, a[n - 1] - d, a[n - 1] + d]]; Array[a, 100] (* Amiram Eldar, Jun 13 2023 *)
Previous Showing 21-27 of 27 results.