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

A326825 a(n) is the number of iterations needed to reach 1 or 5 starting at n and using the map k -> (k/2 if k is even, otherwise k + (smallest triangular number > k)). Set a(n) = -1 if the trajectory never reaches 1 or 5.

Original entry on oeis.org

0, 1, 6, 2, 0, 7, 7, 3, 5, 1, 12, 8, 10, 8, 8, 4, 6, 6, 4, 2, 15, 13, 58, 9, 56, 11, 52, 9, 36, 9, 15, 5, 28, 7, 13, 7, 20, 5, 18, 3, 18, 16, 16, 14, 59, 59, 59, 10, 14, 57, 57, 12, 55, 53, 51, 10, 22, 37, 55, 10, 24, 16, 22, 6, 35, 29, 14, 8, 27, 14, 12, 8, 10, 21, 23, 6, 27, 19
Offset: 1

Views

Author

Ali Sada, Oct 20 2019

Keywords

Comments

It is conjectured that this algorithm will always terminate at 1 or 5.
Jim Nastos verified the conjecture for n <= 354999.
The conjecture holds for all n <= 10^9. - Jon E. Schoenfield, Oct 20 2019

Crossrefs

Cf. A006577, A326823 (similar with squares instead of triangular numbers).

Programs

  • PARI
    M326825=Map([1, 0; 5, 0]); apply( {A326825(n)=if(mapisdefined(M326825, n, &n), n, mapput(M326825, n, 1+n=A326825(if(n%2, n+binomial((sqrtint(8*n+8)+3)\2, 2), n\2))); 1+n)}, [1..77]) \\ M. F. Hasler, May 08 2025

Formula

For n = 11: 11+15 = 26; 26/2 = 13; 13+15 = 28; 28/2 = 14; 14/2 = 7; 7+10 = 17; 17+21 = 38; 38/2 = 19; 19+21 = 40; 40/2 = 20; 20/2 = 10; 10/2 = 5; taking 12 steps to reach 5, so a(11) = 12.

Extensions

Edited by Jon E. Schoenfield and N. J. A. Sloane, Oct 20 2019

A326923 a(n) is the number of iterations needed to reach 1 or 9 starting at n and using the map k -> (k/2 if k is even, otherwise k + (largest triangular number < k)). Set a(n) = -1 if the trajectory never reaches 1 or 9.

Original entry on oeis.org

0, 1, 3, 2, 4, 4, 9, 3, 0, 5, 4, 5, 8, 10, 10, 4, 6, 1, 8, 6, 3, 5, 7, 6, 9, 9, 8, 11, 15, 11, 17, 5, 19, 7, 19, 2, 27, 9, 41, 7, 33, 4, 39, 6, 47, 8, 10, 7, 12, 10, 9, 10, 14, 9, 12, 12, 14, 16, 16, 12, 18, 18, 18, 6, 14, 20, 26, 8, 32, 20, 24, 3, 26, 28, 40, 10, 32
Offset: 1

Views

Author

Ali Sada, Oct 21 2019

Keywords

Comments

It is conjectured that this algorithm will always terminate at 1 or 9.
Jim Nastos verified the conjecture for n <= 64*10^5.
Jim Nastos verified the conjecture for n <= 45248000.

Examples

			For n = 11: 11+10=21; 21+15=36; 36/2=18; 18/2=9; taking 4 steps to reach 9, so a(11)=4.
		

Crossrefs

Programs

  • Maple
    LT:= proc(k) local n;
       n:= ceil((sqrt(1+8*k)-1)/2);
       n*(n-1)/2
    end proc:
    f:= proc(k) option remember; if k::even then 1+procname(k/2) else 1+procname(k+LT(k))fi
    end proc:
    f(1):=0: f(9):= 0:
    map(f, [$1..100]); # Robert Israel, Oct 23 2019
  • Mathematica
    LT[k_] := Module[{n}, n = Ceiling[(Sqrt[1+8k]-1)/2]; n(n-1)/2]; f[k_] := f[k] = If[EvenQ[k], 1+f[k/2], 1+f[k+LT[k]]]; f[1] = 0; f[9] = 0;
    Array[f, 100] (* Jean-François Alcover, Aug 27 2022, after Robert Israel *)
Showing 1-2 of 2 results.