Finding the next term in a sequence: $1,4,17,19,148,.?.$

95 Views Asked by At

Define $a(n)$ to be true if $n\mid(1^1+2^2+3^3+...+n^n)$

So $\{n\in\mathbb N\mid a(n)\}=\{1,4,17,19,148,...\}$

What is the sixth term?

I checked $1\le n\le 1000$, but did not find a sixth term.

Source code

n1= 1
while n1 < 1000:

    num=n1
    sum_num = 0

    for i in range(1, num+1): 
        sum_num += i**i
    n2 = (sum_num)

    if((n2)%num == 0):
        print(n1,"diviasible")
    n1 += 1

2

There are 2 best solutions below

0
On BEST ANSWER
2
On

This is A128981 from OEIS. The next terms are found here: $$ 1, 4, 17, 19, 148, 1577, 3564, 4388, 5873, 6639, 8579, 62500, 376636, 792949, 996044, 1174065, 3333551, 5179004, 7516003,... $$ So the question is why $1577$ didn't appear in your search till $2000$.

Edit: You corrected your search to $1000$. This makes it clear.