OFFSET
0,2
COMMENTS
Linked to its derivation from A322523, this sequence has a natural description: "Given a series of boxes (starting at 0), put each positive integer, in sequence, in the first box in which it is not the sum of two different numbers already in that box. The sequence is the smallest number in each box."
The sequence and associated partition are closely related to powers of 3.
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (4,-3).
FORMULA
For n >= 2, a(n) = (3^n + 7)/2.
For n >= 0, the contents of the n-th box are (conjecture):
1) All the positive integers == b(i) mod 3^(n+1) where 1 <= i <= 2^n and {b(i)} is some strictly increasing sequence of 2^n integers such that b(1)=a(n), b(2^n)= 5*3^(n-1).
2) The additional 'misfit' entry 2*3^n.
[For the correctness and the formula and the conjecture see A322523. - Jianing Song, Oct 17 2022]
EXAMPLE
1, 2 go in box 0 {1,2};
3=1+2 so goes in box 1 {3};
4 goes in box 0 {1,2,4};
5=1+4 so goes in box 1 {3,5};
6=2+4 so goes in box 1 {3,5,6};
7 goes in box 0 {1,2,4,7};
8=7+1=3+5 so goes in box 2 {8};
...
Box 0: {1,2,4,7,10,13,16,19,22,...} = {1} mod 3 U misfit entry 2;
Box 1: {3,5,6,12,14,21,23,...} = {3,5} mod 9 U misfit entry 6;
Box 2: {{8,9,11,15} mod 27} U {18};
Box 3: {{17,20,24,26,27,29,33,45} mod 81} U {54};
...
MATHEMATICA
Join[{1, 3}, (3^Range[2, 50] + 7)/2] (* or *)
LinearRecurrence[{4, -3}, {1, 3, 8, 17}, 50] (* Paolo Xausa, Jun 10 2024 *)
PROG
(Python)
from itertools import count
def A354538(n):
for k in count(1):
c, m = 0, k
while not (a:=divmod(m, 3))[1]:
c += 1
m = a[0]
if not (m==2 or m%3==1):
c += 1
m = (m+1)//3-2
while (a:=divmod(m, 3))[1]:
c += 1
m = a[0]
if c == n: return k # Chai Wah Wu, Oct 15 2022
def A354538(n): return (n<<1)+1 if n<2 else 3**n+7>>1 # based on formula, Chai Wah Wu, Oct 15 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Hugh Williamson, Aug 17 2022
EXTENSIONS
a(7)-a(15) from Michel Marcus, Sep 23 2022
a(16)-a(20) from Chai Wah Wu, Oct 15 2022
a(21)-a(28) from Paolo Xausa, Jun 10 2024
STATUS
approved