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

A270811 Records in A266569.

Original entry on oeis.org

1, 5, 30, 68, 132, 154, 248, 261, 322, 326, 468, 533, 646, 702, 896, 943, 1065, 1103, 1282, 1311, 1442, 1462, 1740, 1751, 1891, 1893, 2117, 2259, 2542, 2675, 2910, 3034, 3416, 3531, 3775, 3881, 4209, 4306, 4559, 4647, 5050, 5129, 5391, 5461, 5834, 5895, 6166, 6218, 6756
Offset: 1

Views

Author

N. J. A. Sloane, Apr 07 2016

Keywords

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = If[EvenQ@ n, 2 n + a[n/2], (n - 1)/2 + a[2 (n + 1)]]; Union@ Rest@ FoldList[Max, 0, #] &@ Array[a, 10^3] (* Michael De Vlieger, May 06 2016 *)

Formula

a(n) = A266569(A270812(n)). - R. J. Mathar, May 06 2016

Extensions

Typo in definition corrected by Felix Fröhlich, Apr 07 2016

A270812 Where records occur in A266569.

Original entry on oeis.org

1, 2, 3, 5, 9, 13, 17, 21, 25, 29, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 113, 121, 129, 137, 145, 153, 161, 177, 193, 209, 225, 241, 257, 273, 289, 305, 321, 337, 353, 369, 385, 401, 417, 433, 449, 465, 481, 497, 513, 529, 545, 561, 577, 593, 609, 625, 641, 657, 673, 705, 737, 769, 801, 833
Offset: 1

Views

Author

N. J. A. Sloane, Apr 07 2016

Keywords

Crossrefs

A270814 a(1)=0; thereafter a(2k)=k+a(k), a(2k+1)=6k+4+a(6k+4).

Original entry on oeis.org

0, 1, 46, 3, 31, 49, 281, 7, 330, 36, 248, 55, 106, 288, 679, 15, 197, 339, 500, 46, 127, 259, 610, 67, 633, 119, 101413, 302, 413, 694, 101073, 31, 808, 214, 505, 357, 498, 519, 2305, 66, 101290, 148, 1295, 281, 452, 633, 100932, 91, 757, 658, 1079, 145, 346, 101440, 102261, 330, 1596, 442, 2128
Offset: 1

Views

Author

N. J. A. Sloane, Apr 08 2016

Keywords

Comments

Inspired by A266569.
In other words, a(n) = n/2 + a(n/2) if n even, a(n) = 3n+1+a(3n+1) if n odd.
From Seiichi Manyama, Apr 25 2016: (Start)
This sequence was inspired by the Collatz problem (A006577).
The Collatz rule is as follows: If n is even, divide it by 2, otherwise multiply it by 3 and add 1 (A006370).
For example, starting with n = 3, one gets the sequence 3, 10, 5, 16, 8, 4, 2, 1. So a(3) = 10 + 5 + 16 + 8 + 4 + 2 + 1 = 46. (End) [Comment edited by N. J. A. Sloane, Apr 25 2016]

Crossrefs

Cf. A006370 (Collatz step), A006577 (trajectory length), A033493 (sum including n).

Programs

  • Maple
    A270814 := proc(n)
            local a, traj ;
            a := 0 ;
            traj := n ;
            while traj > 1 do
                    if type(traj, 'even') then
                            traj := traj/2 ;
                    else
                            traj := 3*traj+1 ;
                    end if;
                    a := a+traj ;
            end do:
            return a;
    end proc:
    [seq(A270814(n),n=1..60)];
  • PARI
    a(n) = my(ret=n-1); while((n>>=valuation(n,2)) > 1, ret+=5*n+2; n=3*n+1); ret; \\ Kevin Ryde, Dec 10 2022

Extensions

Typo in definition corrected by Gionata Neri, Apr 08 2016

A271473 a(1)=0; thereafter a(2k)=k+a(k), a(2k+1)=k+a(6k+4).

Original entry on oeis.org

0, 1, 23, 3, 17, 26, 141, 7, 166, 22, 127, 32, 58, 148, 344, 15, 105, 175, 256, 32, 73, 138, 314, 44, 325, 71, 50699, 162, 218, 359, 50532, 31, 416, 122, 268, 193, 264, 275, 1166, 52, 50645, 94, 664, 160, 246, 337, 50470, 68, 399, 350, 561, 97, 198, 50726, 51137, 190, 821, 247, 1088, 389
Offset: 1

Views

Author

N. J. A. Sloane, Apr 08 2016

Keywords

Comments

Inspired by A266569.

Crossrefs

Programs

  • Maple
    A271473 := proc(n)
            local a, traj ;
            a := 0 ;
            traj := n ;
            while traj > 1 do
                    if type(traj, 'even') then
                            a:=a+traj/2;
                            traj := traj/2 ;
                    else
                            a:=a+(traj-1)/2;
                            traj := 3*traj+1 ;
                    end if;
            end do:
            return a;
    end proc:
    [seq(A271473(n),n=1..60)];
  • Mathematica
    a[1]=0; a[n_] := a[n] = If[EvenQ[n], n/2 + a[n/2], (n - 1)/2 + a[3*(n - 1) + 4]]; Array[a, 60] (* Robert Price, Apr 08 2016 *)

A271478 If n is even, a(n)=n/2, otherwise 2*n+2.

Original entry on oeis.org

0, 4, 1, 8, 2, 12, 3, 16, 4, 20, 5, 24, 6, 28, 7, 32, 8, 36, 9, 40, 10, 44, 11, 48, 12, 52, 13, 56, 14, 60, 15, 64, 16, 68, 17, 72, 18, 76, 19, 80, 20, 84, 21, 88, 22, 92, 23, 96, 24, 100, 25, 104, 26, 108, 27, 112, 28, 116, 29, 120, 30, 124, 31, 128, 32, 132, 33, 136, 34, 140, 35
Offset: 0

Views

Author

N. J. A. Sloane, Apr 10 2016

Keywords

Comments

Arises in studying A266569.

Crossrefs

Programs

  • Maple
    f:=n->if n mod 2 = 0 then n/2 else 2*n+2; fi;
    [seq(f(n),n=0..100)];
  • Mathematica
    Table[(5 n - (-1)^n (3 n + 4) + 4)/4, {n, 0, 70}] (* Ilya Gutkovskiy, Apr 11 2016 *)
  • PARI
    concat(0, Vec(x*(4+x)/((1-x)^2*(1+x)^2) + O(x^50))) \\ Colin Barker, Apr 11 2016
    
  • PARI
    a(n) = if (n % 2, 2*n+2, n/2); \\ Michel Marcus, Apr 11 2016
    
  • Python
    for n in range(0,10**3):
        if(not n%2):print((int)(n/2))
        else:print(2*n+2)
    # Soumil Mandal, Apr 11 2016

Formula

From Colin Barker, Apr 11 2016: (Start)
a(n) = 2*a(n-2)-a(n-4) for n>3.
G.f.: x*(4+x) / ((1-x)^2*(1+x)^2). (End)
a(n) = (5*n - (-1)^n*(3*n + 4) + 4)/4. - Ilya Gutkovskiy, Apr 11 2016

A271479 Number of steps for the trajectory of n under the map k -> A271478(k) to reach 1.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Apr 10 2016

Keywords

Comments

Arises in studying A266569.
Records are 0, 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, ... and occur at positions 1, 2, 3, 5, 9, 17, 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, ...

Crossrefs

Programs

  • Maple
    f:=n->if n mod 2 = 0 then n/2 else 2*n+2; fi; # A271478
    a:=[]; B:=1000;
    for n from 1 to 100 do
       ct:=0; s:=n;
       for k from 1 to B while s>1 do
       s:=f(s); ct:=ct+1; od:
    if ct=B then lprint("error, need to increase limit B"); break; fi;
    a:=[op(a),ct]; od:
    a;
  • Mathematica
    Table[Length[NestWhileList[If[EvenQ[#],#/2,2#+2]&,n,#!=1&]]-1,{n,80}] (* Harvey P. Dale, May 02 2017 *)
  • PARI
    a(n) = if(n--, 3*(logint(n,2)+1) - 2*hammingweight(n), 0); \\ Kevin Ryde, Mar 21 2021

Formula

a(1) = 0; a(2*n) = a(n)+1; a(2*n+1) = a(n+1)+3. - Christian Krause, Mar 19 2021
a(n) = A000120(n-1) + 3*A023416(n-1), for n>=2. - Kevin Ryde, Mar 21 2021
Showing 1-6 of 6 results.