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.

A364801 The number of iterations that n requires to reach a fixed point under the map x -> A022290(x).

Original entry on oeis.org

0, 0, 0, 0, 1, 2, 3, 4, 3, 4, 5, 4, 4, 5, 6, 5, 4, 5, 6, 5, 5, 5, 6, 7, 6, 7, 6, 5, 5, 6, 7, 6, 6, 7, 6, 5, 5, 6, 7, 6, 7, 6, 6, 6, 6, 7, 8, 7, 6, 7, 8, 7, 7, 8, 7, 6, 7, 6, 6, 7, 7, 8, 7, 7, 6, 7, 8, 7, 7, 8, 7, 6, 7, 6, 6, 7, 7, 8, 7, 7, 7, 8, 7, 7, 7, 8, 7
Offset: 0

Views

Author

Amiram Eldar, Aug 08 2023

Keywords

Comments

a(n) is well-defined since A022290(n) = n for n <= 3 (the fixed points), and A022290(n) < n for n >= 4.

Examples

			For n = 4 the trajectory is 4 -> 3. The number of iterations is 1, thus a(4) = 1.
For n = 6 the trajectory is 6 -> 5 -> 4 -> 3. The number of iterations is 3, thus a(6) = 3.
		

Crossrefs

Cf. A022290.
Similar sequences: A003434, A364800.

Programs

  • Mathematica
    f[n_] := f[n] = Module[{d = IntegerDigits[n, 2], nd}, nd = Length[d]; Total[d * Fibonacci[Range[nd + 1, 2, -1]]]]; (* A022290 *)
    a[n_] := -2 + Length@ FixedPointList[f, n]; Array[a, 100, 0]
  • PARI
    f(n) = {my(b = binary(n), nb = #b); sum(i = 1, nb, b[i] * fibonacci(nb - i + 2)); } \\ A022290
    a(n) = if(n < 4, 0, a(f(n)) + 1);
    
  • Python
    def A364801(n):
        if n<4: return 0
        a, b, s = 1, 2, 0
        for i in bin(n)[-1:1:-1]:
            if int(i):
                s += a
            a, b = b, a+b
        return A364801(s)+1 # Chai Wah Wu, Aug 10 2023

Formula

a(n) = a(A022290(n)) + 1, for n >= 4.

A364802 Smallest number that reaches 1 after n iterations of the map x -> A356874(x).

Original entry on oeis.org

1, 2, 3, 5, 11, 29, 117, 879, 15279, 963957, 392158939, 2059426052079
Offset: 0

Views

Author

Amiram Eldar, Aug 08 2023

Keywords

Comments

a(n) is the smallest number k such that A364800(k) = n.

Crossrefs

Similar sequences: A007755, A364803.

Programs

  • Mathematica
    f[n_] := f[n] = Module[{d = IntegerDigits[n, 2], nd}, nd = Length[d]; Total[d * Fibonacci[Range[nd, 1, -1]]]]; (* A356874 *)
    iternum[n_] := Length@ NestWhileList[f, n, # > 1 &] - 1; (* A364800 *)
    seq[kmax_] := Module[{s = {}, imax = -1, i}, Do[i = iternum[k]; If[i > imax, imax = i; AppendTo[s, k]], {k, 1, kmax}]; s]
    seq[10^6]
  • PARI
    f(n) = {my(b = binary(n), nb = #b); sum(i = 1, nb, b[i] * fibonacci(nb - i + 1));} \\ A356874
    iternum(n) = if(n == 1, 0, iternum(f(n)) + 1); \\ A364800
    lista(kmax) = {my(imax = -1, i1); for(k = 1, kmax, i = iternum(k); if(i > imax, imax = i; print1(k, ", ")));}

Extensions

a(11) from Martin Ehrenstein, Aug 26 2023
Showing 1-2 of 2 results.