There is 1 integer congruent to 1, 1 congruent to 2, and 2 congruent to 0 mod 3.
They are all non zero so that makes life easy on us.
Define a(n), b(n) and c(n) as the number of positive integers with n digits congruent to 0,1,2 mod 3, respectively.

a(1) = 2, b(1) = 1, c(1) = 1

a(n+1) = 2a(n) + b(n) + c(n)

b(n+1) = c(n+1) = 2b(1) + c(1) + a(1)

a(2) = 6, b(2) = c(2) = 5

a(3) = 22, b(3) = c(3) = 21

This suggests that a(n) = b(n) + 1 = c(n) + 1, which is easy to prove by induction (i'll leave the proof to you).

The resulting answer would then be a(n) = ((4^n)+2)/3

## Comments

Sort by:

TopNewestThere is 1 integer congruent to 1, 1 congruent to 2, and 2 congruent to 0 mod 3. They are all non zero so that makes life easy on us. Define a(n), b(n) and c(n) as the number of positive integers with n digits congruent to 0,1,2 mod 3, respectively.

a(1) = 2, b(1) = 1, c(1) = 1

a(n+1) = 2a(n) + b(n) + c(n)

b(n+1) = c(n+1) = 2b(1) + c(1) + a(1)

a(2) = 6, b(2) = c(2) = 5

a(3) = 22, b(3) = c(3) = 21

This suggests that a(n) = b(n) + 1 = c(n) + 1, which is easy to prove by induction (i'll leave the proof to you).

The resulting answer would then be a(n) = ((4^n)+2)/3

Log in to reply

3 and 9 are divisible

Log in to reply

2, because 3 and 9 are divisible by 3 whereas 2 and 7 are not.

You're welcome!

Log in to reply

3 and 9

Log in to reply

y el 27?

Log in to reply