1. ## Weird Sequence

Let $\displaystyle a_1=1$. For all $\displaystyle n>1$, define

$\displaystyle a_n=\sum_{\substack{i<n \\ \gcd(i,n)=1}}a_i$

So $\displaystyle a_2=a_1$ and $\displaystyle a_4=a_1+a_3$.
Find $\displaystyle a_{24}$

2. Hello,

Let n be 24

You're looking for $\displaystyle a_{24} = \sum_{\substack{i<24 \\ \gcd(i,24)=1}} a_i$

All i<24 with gcd(i,24)=1 are :
1,2,5,7,11,13,17,19,23

Hence $\displaystyle a_{24} = a_1+a_2+a_5+a_7+a_{11}+a_{13}+a_{17}+a_{19}+a_{23}$

We already know $\displaystyle a_1$ and $\displaystyle a_2$

- let's calculate $\displaystyle a_5$
$\displaystyle a_5 = \sum_{\substack{i<5 \\ \gcd(i,5)=1}}$
All i<5 with gcd(i,5)=1 are : 1,2,3,4

----> $\displaystyle a_5 = a_1+a_2+a_3+a_4$

-------> $\displaystyle a_{24} = a_1+a_2+a_1+a_2+a_3+a_4+a_7+a_{11}+a_{13}+a_{17}+a _{19}+a_{23}$

$\displaystyle a_4=a_1+a_3$

$\displaystyle a_{24} = 2 a_1+2a_2 + a_3+a_4+a_7+a_{11}+a_{13}+a_{17}+a_{19}+a_{23}$ $\displaystyle = 3 a_1+2a_2 + 2a_3+a_7+a_{11}+a_{13}+a_{17}+a_{19}+a_{23}$

- let's calculate $\displaystyle a_3$
All i<3 with gcd(i,3)=1 are : 1,2
$\displaystyle a_3 = a_1+a_2$

-------> $\displaystyle a_{24} = \dots$

And so on... It's always the same thing : when there is an $\displaystyle a_i$ you don't know the value, get the definition, find all the numbers < i and relatively prime with i and continue...

It's kinda hard to type it on a computer... If you really need all the details, i can help you for some following values

1 1
2 1
3 2
4 3
5 7
6 8
7 22
8 32
9 66
10 91
11 233
12 263
13 729
14 1038
15 2059
16 3119
17 7674
18 8666
19 24014
20 32741

I can't promise this is correct; one small mistake would snowball into larger mistakes later.