Denote by an the greatest number that is not divisible by 3 and that divides n. Consider the sequence s0=0,sn=a1+a2+⋯+an,n∈N. Denote by A(n) the number of all sums sk (0≤k≤3n,k∈N0) that are divisible by 3. Prove the formula
A(n)=3n−1+2⋅3(n/2)−1cos(6nπ),n∈N0. trigonometryalgebraSequencecountingrecurrence relationIMO ShortlistIMO Longlist