login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A332941 Lexicographically earliest sequence of positive numbers in which no set of consecutive terms sums to a prime. 2
1, 8, 1, 15, 9, 1, 14, 6, 30, 6, 9, 15, 6, 4, 8, 12, 10, 14, 6, 12, 8, 10, 12, 18, 12, 6, 6, 6, 24, 6, 6, 8, 1, 9, 6, 10, 8, 12, 6, 14, 10, 6, 4, 8, 12, 10, 20, 6, 18, 6, 6, 4, 8, 12, 6, 4, 12, 8, 10, 8, 6, 6, 18, 6, 6, 20, 10, 12, 8, 4, 6, 12, 12, 6, 12, 6, 12 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Terms >= 30 seem to be very rare. Up to a(450000), 30 appears only 7 times: at n = 9, 288, 2507, 15902, 54405, 242728, 425707.

For n <= 450000, the largest term is 32; it appears at n = 335308 and 370687.

LINKS

Table of n, a(n) for n=1..77.

MAPLE

s:= proc(i, j) option remember; `if`(i>j, 0, a(j)+s(i, j-1)) end:

a:= proc(n) option remember; local k; for k while

      ormap(isprime, [k+s(i, n-1)$i=1..n]) do od; k

    end:

seq(a(n), n=1..100);  # Alois P. Heinz, Mar 23 2020

MATHEMATICA

s[i_, j_] := s[i, j] = If[i > j, 0, a[j] + s[i, j-1]];

a[n_] := a[n] = Module[{k}, For[k = 1, AnyTrue[k+Table[s[i, n-1], {i, 1, n}], PrimeQ], k++]; k];

Array[a, 100] (* Jean-Fran├žois Alcover, Nov 17 2020, after Alois P. Heinz *)

PROG

(Python)

def A(ee):

    a=[1]

    print(1)

    n=1

    while n<=ee:

        i=1

        while i>0:

            ii=i

            iz=c=0

            while iz<=len(a):

                c=0

                if ii>2:

                    for j in range(2, int((ii)**0.5+1.5)):

                        if ii%j==0:

                            c=1

                            break

                if c==0 and ii>1:

                    break

                else:

                    iz += 1

                    ii=ii+a[n-iz]

            if c==1:

                n += 1

                a.append(i)

                print(i)

                break

            if i<4:

                i=4

            else:

                i += 1

    return a

CROSSREFS

Cf. A254337, A084833.

Sequence in context: A349123 A158893 A342636 * A107929 A040071 A317026

Adjacent sequences:  A332938 A332939 A332940 * A332942 A332943 A332944

KEYWORD

nonn

AUTHOR

S. Brunner, Mar 03 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 6 16:26 EDT 2022. Contains 357270 sequences. (Running on oeis4.)