From the word itself

Algebra Level 4

We say that a number is arithmetically sequenced if the digits, in order, form an arithmetic sequence. Compute the number of 4-digit positive integers which are arithmetically sequenced.


The answer is 30.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
count = 0
# counts the number of 4-digit (+) ints w/c are arithmetically sequenced

def dafuq(n):
    n_str = str(n)
    hold = int(n_str[1]) - int(n_str[0])

    for i in range(2, 4):
        if int(n_str[i]) - int(n_str[i-1]) != hold:
            return False
    return True    

for n in xrange(1000,10000):
    if dafuq(n):
        count += 1

print count        

汶良 林
Jul 22, 2015

1,2,3,4;4,3,2,1

2,3,4,5;5,4,3,2

3,4,5,6;6,5,4,3

4,5,6,7;7,6,5,4

5,6,7,8;8,7,6,5

6,7,8,9;9,8,7,6

1,3,5,7;7,5,3,1

2,4,6,8;8,6,4,2

3,5,7,9;9,7,5,3

3,2,1,0

6,4,2,0

9,6,3,0

1,1,1,1;2,2,2,2;3,3,3,3;4,4,4,4;5,5,5,5;6,6,6,6;7,7,7,7;8,8,8,8;9,9,9,9

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...