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.

A292591 a(1) = 0, a(2) = 1; and for n > 2, a(n) = 2*a(A285712(n)) + [1 == (n mod 3)].

Original entry on oeis.org

0, 1, 2, 5, 2, 10, 21, 4, 42, 85, 10, 170, 5, 4, 340, 681, 20, 8, 1363, 42, 2726, 5453, 8, 10906, 11, 84, 21812, 21, 170, 43624, 87249, 20, 40, 174499, 340, 348998, 697997, 10, 16, 1395995, 8, 2791990, 85, 680, 5583980, 43, 1362, 168, 11167961, 40, 22335922, 44671845, 16, 89343690, 178687381, 2726, 357374762, 341, 84, 80, 23, 5452, 8, 714749525, 10906
Offset: 1

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

Binary expansion of a(n) encodes the positions of numbers of the form 3k+1 (with k >= 1) in the path taken from n to the root in the binary trees A245612 and A244154, except that the most significant 1-bit of a(n) always corresponds to 2 instead of 1 at the root of those trees.

Crossrefs

Programs

  • Mathematica
    f[n_] := f[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; a[n_] := a[n] = If[n <= 2, n - 1, 2 a[f@ n] + Boole[Mod[n, 3] == 1]]; Array[a, 65] (* Michael De Vlieger, Sep 22 2017 *)
  • Scheme
    (define (A292591 n) (if (<= n 2) (- n 1) (+ (if (= 1 (modulo n 3)) 1 0) (* 2 (A292591 (A285712 n))))))

Formula

a(n) + A292590(n) = A245611(n).
a(A245612(n)) = A292593(n).
A000120(a(n)) = A292595(n).

A292594 a(n) = A000120(A292590(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

Locate the node which contains n in binary tree A245612 (or in its mirror-image A244154) and traverse from that node towards the root, counting all multiples of three that occur on the path. More formally, for n > 1, a(n) counts the multiples of 3 encountered until 1 is reached, when we iterate the map x -> A285712(x), starting from x=n. The count includes also n itself if it is a multiple of 3.

Crossrefs

Programs

  • Mathematica
    f[n_] := f[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; a[n_] := a[n] = If[n == 1, n - 1, 2 a[f@ n] + Boole[Divisible[n, 3]]]; Array[DigitCount[a@ #, 2, 1] &, 105] (* Michael De Vlieger, Sep 22 2017 *)

Formula

a(1) = 0; and for n > 1, a(n) = A079978(n) + a(A285712(n)).
a(n) = A000120(A292590(n)).
a(n) + A292595(n) = A285715(n).
Showing 1-2 of 2 results.