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

A046901 a(n) = a(n-1) - n if a(n-1) > n, else a(n) = a(n-1) + n.

Original entry on oeis.org

1, 3, 6, 2, 7, 1, 8, 16, 7, 17, 6, 18, 5, 19, 4, 20, 3, 21, 2, 22, 1, 23, 46, 22, 47, 21, 48, 20, 49, 19, 50, 18, 51, 17, 52, 16, 53, 15, 54, 14, 55, 13, 56, 12, 57, 11, 58, 10, 59, 9, 60, 8, 61, 7, 62, 6, 63, 5, 64, 4, 65, 3, 66, 2, 67, 1, 68, 136, 67, 137
Offset: 1

Views

Author

Keywords

Comments

Variation (1) on Recamán's sequence A005132.
a(A134931(n-1)) = 1. - Reinhard Zumkeller, Jan 31 2013

Crossrefs

Programs

  • Haskell
    a046901 n = a046901_list !! (n-1)
    a046901_list = scanl1 (\u v -> if u > v then u - v else u + v) [1..]
    -- Reinhard Zumkeller, Dec 07 2015, Jan 31 2013
  • Maple
    A046901 := proc(n) option remember; if n = 1 then 1 else if A046901(n-1)>n then A046901(n-1)-n else A046901(n-1)+n; fi; fi; end;
  • Mathematica
    a[1]=1;a[n_]:=a[n]=If[a[n-1]>n,a[n-1]-n,a[n-1]+n]; Table[a[i],{i,70}]  (* Harvey P. Dale, Apr 01 2011 *)
    nxt[{n_,a_}]:={n+1,If[a>n+1,a-n-1,a+n+1]}; NestList[nxt,{1,1},70][[All,2]] (* Harvey P. Dale, Jun 01 2019 *)
  • PARI
    a(n)=if(n<2,1,a(n-1)-if(sign(n-a(n-1))+1,-1,1)*n);
    

Formula

This is a concatenation S_0, S_1, S_2, ... where S_i = [b_0, b_1, ..., b_{k-1}], k=5*3^i, with b_0 = 1, b_{2j} = k+j, b_{2j+1} = (k+1)/2-j. E.g., S_0 = [1, 3, 6, 2, 7].
For any m>=1, for k such that 5*3^k+3>12m, a((5*3^k+3-12*m)/6)= m. For example, for k>=1, a((5*3^k-9)/6) = 1. - Benoit Cloitre, Oct 31 2002
a(n) = A008343(n+1) + 1. - Jon Maiga, Jul 09 2021

A076042 a(0) = 0; thereafter a(n) = a(n-1) + n^2 if a(n-1) < n^2, otherwise a(n) = a(n-1) - n^2.

Original entry on oeis.org

0, 1, 5, 14, 30, 5, 41, 90, 26, 107, 7, 128, 272, 103, 299, 74, 330, 41, 365, 4, 404, 845, 361, 890, 314, 939, 263, 992, 208, 1049, 149, 1110, 86, 1175, 19, 1244, 2540, 1171, 2615, 1094, 2694, 1013, 2777, 928, 2864, 839, 2955, 746, 3050, 649, 3149
Offset: 0

Views

Author

Amarnath Murthy, Oct 29 2002

Keywords

Comments

Does not return to zero within first 2^25000 =~ 10^7525 terms. Define an epoch as an addition followed by a sequence of (addition, subtraction) pairs. The first epoch has length 1 (+), the second 3 (++-), the third 5 (++-+-), and so forth (cf. A324792). The epoch lengths increase geometrically by about the square root of 3, and the value at the end of each epoch is the low value in the epoch. These observations lead to the Python program given. - Tomas Rokicki, Aug 31 2019
Using the Maple program in A324791, I confirmed that a(n) != 0 for 0 < n < 10^2394. See the a- and b-files in A325056 and A324791. - N. J. A. Sloane, Oct 03 2019
'Easy Recamán transform' of the squares. - Daniel Forgues, Oct 25 2019

Crossrefs

See also A325056, A324791, A324792.
Cf. A053461 ('Recamán transform' of the squares).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<0, 0,
          ((s, t)-> s+`if`(sAlois P. Heinz, Jan 11 2020
  • Mathematica
    a[0] = 0;
    a[n_] := a[n] = a[n-1] + If[a[n-1] < n^2, n^2, -n^2];
    a /@ Range[0, 50] (* Jean-François Alcover, Apr 11 2020 *)
  • PARI
    v=vector(50); v[1]=1; for(n=2,50,if(v[n-1]
    				

Extensions

More terms from Ralf Stephan, Mar 20 2003
a(0)=0 prepended, at the suggestion of Allan C. Wechsler, by N. J. A. Sloane, Aug 31 2019
Offset set to 0, to cohere with previous action of N. J. A. Sloane, by Allan C. Wechsler, Sep 08 2019

A076041 a(n) = n! for n < 4; else a(n) = floor(P(n-1)/n) where P(n) = a(1) * a(2) * ... * a(n).

Original entry on oeis.org

1, 2, 6, 3, 7, 42, 1512, 2000376, 3556892570112, 11386336279786153952123289, 117862412614885811248635740101130996768076206774085
Offset: 1

Views

Author

Amarnath Murthy, Oct 29 2002

Keywords

Comments

Original definition: a(1)=1, a(n)=n*P(n-1) if P(n-1) < n, a(n) = floor(P(n-1)/n) if n <= P(n-1), where P(n-1) = a(1) * a(2) * ... * a(n-1).
Next term a(12) = 1273391928...9197035520 ~ 1.27*10^100 has 101 digits. - M. F. Hasler, Oct 21 2014

Examples

			a(4) = floor(1*2*6/4) = 3.
a(5) = floor(1*2*6*3/5) = floor(36/5) = 7.
		

Crossrefs

Programs

  • Mathematica
    a[1] = 1; p[n_] := Product[a[k], {k, 1, n}]; a[n_ /; p[n-1] < n] := a[n] = n*p[n-1]; a[n_ /; n < p[n-1]] := a[n] = Floor[p[n-1]/n]; Table[a[n], {n, 1, 12}] (* Jean-François Alcover, Jul 22 2013 *)
  • PARI
    a(n)=if(n<4,n!,P=3!;for(i=3,n-1,P*=P\i);P\n) \\ M. F. Hasler, Oct 21 2014

Extensions

Corrected and extended by Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 20 2003
Edited by M. F. Hasler, Oct 21 2014

A323615 a(0) = 1; for n > 0, a(n) = floor(a(n-1)/n) if positive and not already in the sequence, otherwise a(n) = a(n-1)*n.

Original entry on oeis.org

1, 1, 2, 6, 24, 4, 24, 3, 24, 216, 21, 231, 19, 247, 17, 255, 15, 255, 14, 266, 13, 273, 12, 276, 11, 275, 10, 270, 9, 261, 8, 248, 7, 231, 7854, 224, 8064, 217, 5, 195, 7800, 190, 7980, 185, 8140, 180, 8280, 176, 8448, 172, 8600, 168, 8736, 164
Offset: 0

Views

Author

Jan Koornstra, Jan 20 2019

Keywords

Comments

Variation on A008336 using floor division and A076039 not allowing for values already in the sequence.

Examples

			a(5) = 4, since floor(24/5) = 4, which is positive and not already in the sequence.
a(6) = 24, since floor(4/6) = 0, hence not positive.
		

Crossrefs

Programs

  • Mathematica
    Nest[Append[#1, If[And[#3 > 0, FreeQ[#1, #3]], #3, #2 #1[[-1]] ]] & @@ {#1, #2, Floor[#1[[-1]]/#2]} & @@ {#, Length@ #} &, {1}, 53] (* Michael De Vlieger, Jan 23 2019 *)
  • Python
    def a323615(n):
      seq = []
      for i in range(n + 1):
        if i == 0: x = 1
        else:
          x = seq[i - 1] // i
          if x in seq or x == 0: x = seq[i - 1] * i
        seq.append(x)
      return seq
    print(a323615(100))
Showing 1-4 of 4 results.