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.

A090895 a(1)=1 then a(n)=a(n-1)/2 if a(n-1) is even, a(n)=a(n-1)+n otherwise.

Original entry on oeis.org

1, 3, 6, 3, 8, 4, 2, 1, 10, 5, 16, 8, 4, 2, 1, 17, 34, 17, 36, 18, 9, 31, 54, 27, 52, 26, 13, 41, 70, 35, 66, 33, 66, 33, 68, 34, 17, 55, 94, 47, 88, 44, 22, 11, 56, 28, 14, 7, 56, 28, 14, 7, 60, 30, 15, 71, 128, 64, 32, 16, 8, 4, 2, 1, 66, 33, 100, 50, 25, 95, 166, 83, 156, 78, 39
Offset: 1

Views

Author

Benoit Cloitre, Feb 25 2004

Keywords

Comments

Does a(n)=1 for infinitely many values of n ?
It seems that the answer is yes (see A185038). The number a(n) is always in the range on 1 to 3*a(n), and there is an average of 2 addition steps for every 5 steps. In order to reach '1', the sequence must reach a power of two after an addition step, which is likely to happen on an exponential basis. [Sergio Pimentel, Mar 01 2012]
a(A208852(n)) = n and a(m) != n for m < A208852(n); A185038(a(n)) = 1. [Reinhard Zumkeller, Mar 02 2012]

Crossrefs

Programs

  • Haskell
    a090895 n = a090895_list !! (n-1)
    a090895_list = 1 : f 2 1 where
       f x y = z : f (x + 1) z where
            z = if m == 0 then y' else x + y; (y',m) = divMod y 2
    -- Reinhard Zumkeller, Mar 02 2012
  • Mathematica
    nxt[{n_,a_}]:={n+1,If[EvenQ[a],a/2,a+n+1]}; Transpose[NestList[nxt,{1,1},80]][[2]] (* Harvey P. Dale, Aug 25 2015 *)
  • PARI
    a(n)=if(n<2,1,if(a(n-1)%2,a(n-1)+n,a(n-1)/2))
    

Formula

sum(k=1, n, a(k)) seems to be asymptotic to c*n^2 where c=0.57....

A135294 a(n) = 3*a(n-1)+n if a(n-1) is not divisible by 2, or a(n) = a(n-1)/2 otherwise.

Original entry on oeis.org

1, 4, 2, 1, 7, 26, 13, 46, 23, 78, 39, 128, 64, 32, 16, 8, 4, 2, 1, 22, 11, 54, 27, 104, 52, 26, 13, 66, 33, 128, 64, 32, 16, 8, 4, 2, 1, 40, 20, 10, 5, 56, 28, 14, 7, 66, 33, 146, 73, 268, 134, 67, 253, 812, 406, 203, 665, 2052, 1026, 513, 1599, 4858, 2429, 7350, 3675, 11090, 5545, 16702, 8351, 25122, 12561
Offset: 1

Views

Author

Ctibor O. Zizka, Dec 04 2007

Keywords

Comments

a(n)=a(0)*(3^(n-i))/(2^i) + c where c is in the range (0..sum(i*3^(n-i))). Sum(i*3^(n-i)) for i=1 to n equals A001793 (coefficients of Chebyshev polynomials). Max a(n) = 3^n*(a(0)/3^i*2^i + 9/4) - ((2*n+5)/4) which for large n gives max a(n) ~ 2.25*3^n - n/2. - Ctibor O. Zizka, Dec 26 2007

Crossrefs

Cf. A135287.

Programs

  • Mathematica
    nxt[{n_,a_}]:={n+1,If[OddQ[a],3a+n,a/2]}; NestList[nxt,{1,1},70][[;;,2]] (* Harvey P. Dale, Oct 01 2024 *)

Extensions

Corrected and extended by Harvey P. Dale, Oct 01 2024

A345877 a(1) = 1, a(n) = a(n-1)/2 if a(n-1) is even, otherwise a(n) = n - a(n-1).

Original entry on oeis.org

1, 1, 2, 1, 4, 2, 1, 7, 2, 1, 10, 5, 8, 4, 2, 1, 16, 8, 4, 2, 1, 21, 2, 1, 24, 12, 6, 3, 26, 13, 18, 9, 24, 12, 6, 3, 34, 17, 22, 11, 30, 15, 28, 14, 7, 39, 8, 4, 2, 1, 50, 25, 28, 14, 7, 49, 8, 4, 2, 1, 60, 30, 15, 49, 16, 8, 4, 2, 1, 69, 2, 1, 72, 36, 18, 9, 68, 34, 17, 63, 18, 9, 74, 37, 48, 24, 12, 6, 3
Offset: 1

Views

Author

Altug Alkan, Jun 28 2021

Keywords

Comments

Let a_i(1) = 1 and a_i(n) = a_i(n-1)/(i+1) if a_i(n-1) is divisible by i+1, otherwise a_i(n) = n - a_i(n-1). This sequence is a_1(n) and A345886 is a_2(n).
Conjecture: a_i(n) hits every positive integers infinitely many times for all i >= 1.

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = If[EvenQ[a[n - 1]], a[n - 1]/2, n - a[n - 1]]; Array[a, 100] (* Amiram Eldar, Jun 29 2021 *)
    nxt[{n_,a_}]:={n+1,If[EvenQ[a],a/2,n+1-a]}; NestList[nxt,{1,1},90][[;;,2]] (* Harvey P. Dale, Aug 31 2023 *)
  • PARI
    q=vector(100); q[1]=1; for(n=2, #q, q[n] = if(q[n-1]%2, n-q[n-1], q[n-1]/2)); q

A134440 a(0)=1; for n > 0, a(n) = a(n-1) + prime(n) if a(n-1) is odd, else a(n) = a(n-1)/2.

Original entry on oeis.org

1, 3, 6, 3, 10, 5, 18, 9, 28, 14, 7, 38, 19, 60, 30, 15, 68, 34, 17, 84, 42, 21, 100, 50, 25, 122, 61, 164, 82, 41, 154, 77, 208, 104, 52, 26, 13, 170, 85, 252, 126, 63, 244, 122, 61, 258, 129, 340, 170, 85, 314, 157, 396, 198, 99, 356, 178, 89, 360, 180, 90, 45
Offset: 0

Views

Author

Ctibor O. Zizka, Jan 18 2008

Keywords

Comments

LFSR with primes.
Is it true that Lim a(n)/prime(n) < square root(3)?

References

  • T. Herlestam, On functions of linear shift register sequences. Springer Lecture notes in computer sciences, ISBN 978-3-540-16468-5.

Crossrefs

Programs

  • Maple
    A134440 := proc(n)
        option remember;
        if n =0 then
            1;
        elif type(procname(n-1),'odd') then
            procname(n-1)+ithprime(n) ;
        else
            procname(n-1)/2 ;
        end if;
    end proc: # R. J. Mathar, Jun 20 2021
  • Mathematica
    nxt[{n_,a_}]:={n+1,If[OddQ[a],a+Prime[n+1],a/2]}; Transpose[ NestList[ nxt,{0,1},70]][[2]] (* Harvey P. Dale, Jan 12 2016 *)

Extensions

Offset corrected by R. J. Mathar, Jun 20 2021
Showing 1-4 of 4 results.