login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Rearrangement of cubes such that the sum of two consecutive terms + 1 is a prime.
1

%I #13 Dec 03 2024 19:50:23

%S 1,27,729,2197,1331,6859,24389,343,3375,9261,59319,35937,15625,12167,

%T 29791,125,4913,79507,19683,389017,91125,166375,132651,117649,185193,

%U 2460375,50653,42875,300763,250047,753571,148877,205379,68921,226981

%N Rearrangement of cubes such that the sum of two consecutive terms + 1 is a prime.

%H Sean A. Irvine, <a href="/A073537/b073537.txt">Table of n, a(n) for n = 1..1000</a>

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice

%o def agen(): # generator of terms

%o rset, an, r, m = set(), 1, 1, 3

%o while True:

%o yield an

%o rset.add(r)

%o r = next(k for k in count(m, 2) if k not in rset and isprime(k**3 + an + 1))

%o an = r**3

%o while m in rset: m += 2

%o print(list(islice(agen(), 35))) # _Michael S. Branicky_, Dec 03 2024

%Y Cf. A000578.

%K nonn

%O 1,2

%A _Jason Earls_, Aug 27 2002