%I M0427 #31 Mar 11 2024 01:55:55
%S 1,1,2,3,2,5,2,21,2,3,1,55,3,13,2,21,2,85,1,57,2,1,1,8855,2,15,2,39,1,
%T 29,10,651,2,1,2,935,1,37,2,399,1,2665,1,129,2,1,1,416185,2,21,2,15,1,
%U 4505,2,39,14,1,1,357599,1,305,2,651,6,5,1,201,2,39,1,10687985,2,73,2
%N Related to n-th powers of polynomials.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Chai Wah Wu, <a href="/A005731/b005731.txt">Table of n, a(n) for n = 1..10000</a>
%H T. Chinburg and M. Henriksen, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa29/aa2932.pdf">Sums of k-th powers in the ring of polynomials with integer coefficients</a>, Acta Arithmetica, 29 (1976), 227-250.
%F a(n) = A005729(n)/A005730(n).
%o (Python)
%o from itertools import count
%o from sympy import nextprime
%o def A005731(n):
%o c, p = 1, 2
%o while p < n:
%o if n%p:
%o for m in count(2):
%o if (p**m-1)//(p-1) > n:
%o break
%o for r in count(1):
%o q = (p**(m*r)-1)//(p**r-1)
%o if q > n:
%o break
%o if not n % q:
%o c *= p
%o break
%o else:
%o continue
%o if q <= n:
%o break
%o p = nextprime(p)
%o return c # _Chai Wah Wu_, Mar 10 2024
%Y Cf. A005729, A005730.
%K nonn
%O 1,3
%A _N. J. A. Sloane_
%E More terms from _Emeric Deutsch_, Jan 24 2005