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.

A358094 a(n) is the number of ways n can be reached in the following method: we start with 1, then add or multiply alternately, and each operand must be 2 or 3.

Original entry on oeis.org

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

Views

Author

Yifan Xie and Thomas Scheuerle, Oct 29 2022

Keywords

Comments

We may start either with multiplication or summation. After summation the next step will be multiplication or vice versa.
From Thomas Scheuerle, Oct 30 2022: (Start)
The only zero in this sequence is at a(7). Proof: Let k be any number greater than 1026. If k is even subtract 2, if k is odd subtract 3, then divide by two. Repeat this process until k < 1024. Obviously we will get some number between 511 and 1024. By computation it is known that all these numbers can be reached. They can be reached if we start with multiplication and if we start with addition we can reach all these numbers too.
Conjecture: All numbers greater than 145 can be reached in at least 3 different ways. Numbers greater than 145 which can be reached in only three ways are all of the form 27*2^k - 5 (A304387). This is conjectured to arise from the relation: 27*2^(k+2) - 5 = 3*(27*2^(k+1) - 5) - 2*(27*2^k - 5) which is in some sense here the worst case in between *2 and *3. (End)
Proof of the conjecture: We use the identities in A358095. For n > 145, if a(n) <= 2, A358095(n) <= 2. Therefore, n must be a*3*2^k - 2, where a is in the set {3, 7, 26, 30, 32, 34, 40, 49} and k is a positive integer. However, A358096(a*3*2^k - 2) = A358095(a*3*2^(k-1) - 1) >= 3, a contradiction. Hence all numbers greater than 145 can be reached in at least 3 different ways. If a(n) = 3, the only possibilities are that A358095(n) = 0 and A358096(n) = 3 or A358095(n) = 3 and A358096(n) = 0. For the first one, n must be 9*2^k - 2, so A358096(n) = A358095(9*2^(k-1) - 1) >= 4. For the second one, if n is in the form a*3*2^k - 2, A358096(n) = A358095(a*3*2^(k-1) - 1) >= 4; if n = 108*2^k - 3, A358096(n) = A358095(36*2^k - 1) >= 4; if n is in the form 108*2^k - 5, A358096(n) = 0. Hence a(n) = 3 iff n = 27*2^k - 5 for n > 145. - Yifan Xie, Jan 07 2025

Examples

			There are 3 ways reaching 8: (1+3)*2=8, (1*2+2)*2=8 and (1+2)*2+2=8, so a(8)=3.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(n=1, 1, add(`if`(t=1 and i `if`(n=1, 1, add(b(n, i), i=0..1)):
    seq(a(n), n=1..80);  # Alois P. Heinz, Jan 12 2024
  • Mathematica
    b[n_,t_]:=b[n, t]=If[n == 1,1,Sum[If[t == 1 && iJames C. McMahon, Jan 29 2024 *)
  • PARI
    { for (n=1, #a=vector(#m=vector(80)), if (n==1, a[n] = m[n] = 1, if (n-2>0, a[n] += m[n-2];); if (n-3>0, a[n] += m[n-3];); if (n%2==0, m[n] += a[n/2];); if (n%3==0, m[n] += a[n/3];);); print1 (a[n]+m[n]-(n==1)", ");); } \\ Rémy Sigrist, Oct 30 2022

Formula

a(n) = A358095(n) + A358096(n) for n > 1.
From Thomas Scheuerle, Oct 30 2022: (Start)
a(n + 2*(2^floor(log_2(n)) - 1) + b) >= 1, with b = {0, 2, 3}. This is the set of numbers which may be reached by only using *2.
a(A005836(n) + 2*(3^floor(log_3(n)) - 1) + b) >= 1, with b = {0, 2, 3}. These numbers can be reached by only using *3. (End)

A358095 a(n) is the number of ways n can be reached in the algorithm explained in A358094 if the last operation is summation.

Original entry on oeis.org

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

Views

Author

Yifan Xie, Nov 01 2022

Keywords

Comments

From Yifan Xie, Jan 07 2025: (Start)
The following identities can be proved by induction (k, t are nonnegative integers):
a(n) = 0 iff n = 2 or n = 9*2^k - 2.
a(n) = 1 iff n = 1, 3, 6, 8, 9 or n = 21*2^k - 2.
If n > 71, a(n) = 2 iff n = m*3*2^k - 2, where m is in the set {26, 30, 32, 34, 40, 49}.
If n > 85, a(n) = 3 iff n = 108*2^k - 2, 108*2^k - 3, 108*2^k - 4, 108*2^k - 5, 123*2^k - 2, 126*2^k - 2, 132*2^k - 2, 150*2^k - 2, 174*2^k - 2, 210*2^k - 2, (108*2^t - 3)*2^k - 2.
If n > 60, a(n) = 4 iff n = 114*2^k - 2. (End)

Examples

			There are 3 ways to reach 11: (1*2+2)*2+3=11, (1+3)*2+3=11 and (1+2)*3+2=11.
		

Crossrefs

Formula

a(n) = A358096(n-2) + A358096(n-3) for n > 3.
a(6k) = a(2k-1) + a(3k-1); a(6k+1) = a(3k-1); a(6k+2) = a(6k+3) = a(2k) + a(3k); a(6k+4) = a(3k+1); a(6k+5) = a(2k+1) + a(3k+1). - Yifan Xie, Jan 07 2025
Showing 1-2 of 2 results.