OFFSET
1,2
COMMENTS
p divides a(p+1) for all prime p except 3. p^2 divides a(p+1) for prime p in A123374.
2 divides a(n) for n = {2, 3, 4, 6, 7, 8, 10, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, 28, 30, 31, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 46, 47, 48, 50, ...}.
2^2 divides a(n) for n = {2, 3, 6, 7, 8, 10, 11, 14, 15, 16, 18, 19, 22, 23, 24, 26, 27, 30, 31, 32, 34, 35, 38, 39, 40, 42, 43, 46, 47, 48, 50, ...}.
2^3 divides a(n) for n = {2, 3, 6, 7, 10, 11, 14, 15, 16, 18, 19, 22, 23, 26, 27, 30, 31, 32, 34, 35, 38, 39, 42, 43, 46, 47, 48, 50, ...}.
2^4 divides a(n) for n = {7, 14, 15, 18, 23, 30, 31, 32, 34, 39, 46, 47, 50, ...}.
2^5 divides a(n) for n = {15, 30, 31, 34, 47, 62, 63, 64, 66, 79, 94, 95, 98, ...}.
2^6 divides a(n) for n = {31, 62, 63, 66, 95, ...}.
2^7 divides a(n) for n = {63, 126, 127, 130, ...}.
It appears that for k > 2 the least few n such that a(n) is divisible by 2^(k+1) are n = {(2^k-1), 2*(2^k-1), 2*(2^k-1)+1, 2*(2^k-1)+3, 3*(2^k-1)+2, 4*(2^k-1)+2, 4*(2^k-1)+3, 4*(2^k-1)+4, 4*(2^k-1)+6, 5*(2^k-1)+4, 6*(2^k-1)+4, 6*(2^k-1)+5, 6*(2^k-1)+8, ...}. - Alexander Adamchuk, Oct 08 2006
Numbers n that divide a(n) are listed in A014741. - Alexander Adamchuk, Nov 03 2006
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..385
FORMULA
1 - Psi(n) - gamma + Sum_{i=2..n} (i^(n+1)/(i-1)), where Psi(n) is the digamma function and gamma is Euler's constant.
a(n) = Sum[ i^j, {i,1,n}, {j,1,n} ] = n + Sum[ i*(i^n - 1)/(i - 1), {i,2,n} ]. - Alexander Adamchuk, Nov 03 2006
a(n) = Sum_{k=1..n} (B(k+1, n+1) - B(k+1, 1))/(k+1), where B(n, x) are the Bernoulli polynomials. - Daniel Suteu, Jun 25 2018
a(n) ~ c * n^n, where c = 1 / (1 - exp(-1)) = A185393 = 1.58197670686932642438... - Vaclav Kotesovec, Nov 06 2021
EXAMPLE
a(2) = 8 = 1 + 1 + 2 + 4 = 1^1 + 1^2 + 2^1 + 2^2.
MAPLE
seq(1-Psi(n)-gamma+sum(i^(n+1)/(i-1), i = 2 .. n), n=1..20);
MATHEMATICA
Table[Sum[i^j, {i, 1, n}, {j, 1, n}], {n, 1, 24}] (* Alexander Adamchuk, Oct 08 2006 *)
Table[ n + Sum[ i*(i^n-1)/(i-1), {i, 2, n} ], {n, 1, 17} ] (* Alexander Adamchuk, Nov 03 2006 *)
PROG
(PARI) a(n)=sum(i=1, n, sum(j=1, n, i^j)) \\ Charles R Greathouse IV, Jul 19 2013
(PARI) a(n)=round(1-psi(n)-Euler+sum(i=2, n, i^(n+1)/(i-1))) \\ Charles R Greathouse IV, Jul 19 2013
(Python)
def A086787(n): return sum(i**j for i in range(1, n+1) for j in range(1, n+1)) # Chai Wah Wu, Jan 08 2022
(Python)
from sympy import digamma, EulerGamma
from fractions import Fraction
def A086787(n): return 1-digamma(n)-EulerGamma + sum(Fraction(i**(n+1), i-1) for i in range(2, n+1)) # Chai Wah Wu, Jan 08 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Aug 04 2003
EXTENSIONS
Edited by Max Alekseyev, Jan 29 2012
STATUS
approved