A357579 Lexicographically earliest sequence of distinct numbers such that no sum of consecutive terms is a square or higher power of an integer.
2, 3, 7, 5, 6, 12, 10, 11, 17, 18, 15, 13, 20, 14, 23, 19, 28, 26, 22, 21, 29, 33, 35, 37, 24, 31, 30, 38, 34, 41, 39, 40, 44, 43, 46, 42, 51, 45, 54, 53, 48, 57, 47, 50, 59, 52, 61, 58, 55, 60, 56, 66, 67, 65, 62, 70, 63, 69, 73, 72, 76, 74, 68, 79
Offset: 1
Keywords
Examples
Clearly 0 and 1 are powers of themselves so they are rejected. 2 is the first term. Then neither 3 nor (3+2) is a power so 3 is accepted. 4 is a power and thus rejected. (5+3) is 2^3, so reject (for now) 5. Same for 6; (7+3) and (7+3+2) are not powers, so 7 is accepted.
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
- Rémy Sigrist, PARI program
- Carl Witthoft, R program
Crossrefs
Cf. A254337.
Programs
-
PARI
See Links section.
-
Python
def is_pow(n, k): while n%k == 0: n = n//k return n == 1 def any_power(n): return any((is_pow(n, k) for k in range(2,1+n//2))) terms,s,sums = [2,], set((2,)), set((2,)) for i in range(100): t = 3 while t in s or any_power(t) or any((any_power(j + t) for j in sums)): t+=1 s.add(t);terms.append(t) sums = set(map(lambda k:k+t, sums)) sums.add(t) print(terms) # Gleb Ivanov, Oct 07 2022
-
R
# hasAnyPwr and helper function are in the GitHub link
Comments