cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A332941 Lexicographically earliest sequence of positive numbers in which no set of consecutive terms sums to a prime.

Original entry on oeis.org

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
Offset: 1

Views

Author

S. Brunner, Mar 03 2020

Keywords

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.

Crossrefs

Programs

  • 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 *)
  • 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

A084834 a(n) is the smallest number not previously used such that a(n)+a(n-1), a(n)+a(n-1)+a(n-2), ..., a(n)+...+a(1) are not prime.

Original entry on oeis.org

1, 3, 5, 7, 9, 11, 13, 15, 17, 4, 6, 30, 38, 10, 36, 14, 34, 42, 39, 21, 69, 27, 33, 45, 20, 16, 24, 50, 25, 51, 66, 18, 72, 54, 60, 74, 22, 8, 19, 41, 28, 48, 44, 40, 78, 57, 35, 58, 102, 12, 63, 65, 64, 56, 46, 96, 68, 76, 114, 80, 52, 84, 90, 99, 55, 2, 93, 75, 100, 62, 120, 98
Offset: 1

Views

Author

Jon Perry, Jun 06 2003

Keywords

Comments

No sum of a continuous subsequence is ever prime. Is every integer used? Can an odd number ever be surrounded by two even numbers (and similarly for even numbers)?

Examples

			a(4)=7 because 7 is the smallest unused number such that 1+3+5+x, 3+5+x and 5+x are all composite
		

Crossrefs

Programs

  • PARI
    checkprime(a,b)=local(fl); fl=0; for (i=1,b-1,if (isprime(a+s[i]),fl=1; break)); if (fl==0, for (j=1,b-1,if (a==p[j],fl=1; break))); fl
    p=vector(300); p[1]=1; pc=2; while (pc<300, x=1; s=vector(300); for (i=1,pc-1,s[i]=sum(k=i,pc-1,p[k])); i=1; while (checkprime(x,pc),x++); p[pc]=x; pc++); p

A360019 Lexicographically earliest increasing sequence of positive numbers in which no nonempty subsequence of consecutive terms sums to a triangular number.

Original entry on oeis.org

2, 5, 7, 11, 12, 14, 16, 17, 18, 19, 20, 22, 25, 26, 30, 31, 34, 35, 37, 42, 46, 49, 52, 54, 59, 63, 64, 68, 72, 73, 77, 80, 81, 84, 85, 87, 92, 93, 94, 98, 100, 101, 108, 113, 115, 117, 118, 121, 122, 123, 125, 129, 130, 132, 133, 134, 141, 142, 143, 146, 149
Offset: 0

Views

Author

Ctibor O. Zizka, Jan 21 2023

Keywords

Comments

The sequence cannot contain any triangular numbers.

Examples

			a(0) = 2 by the definition of the sequence. The next number > a(0) is 3, but it is a triangular number, so we try 4, but 2 + 4 = 6 is a triangular number. Then we try 5; {5, 2 + 5} are not triangular numbers, thus a(1) = 5. a(2) cannot be 6, so we try 7; {7, 5 + 7, 2 + 5 + 7} are not triangular numbers, thus a(2) = 7.
		

Crossrefs

Programs

  • Maple
    q:= proc(n) option remember; issqr(8*n+1) end:
    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 from 1+a(n-1) while
          ormap(q, [k+s(i, n-1)$i=0..n]) do od; k
        end: a(-1):=-1:
    seq(a(n), n=0..60);  # Alois P. Heinz, Jan 21 2023
  • Mathematica
    triQ[n_] := IntegerQ @ Sqrt[8*n + 1]; a[0] = 2; a[n_] := a[n] = Module[{k = a[n - 1] + 1, t = Accumulate @ Table[a[i], {i, n - 1, 0, -1}]}, While[triQ[k] || AnyTrue[t + k, triQ], k++]; k]; Array[a, 61, 0] (* Amiram Eldar, Jan 21 2023 *)

Extensions

More terms from Jon E. Schoenfield, Jan 21 2023
Showing 1-3 of 3 results.