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-10 of 13 results. Next

A253074 Lexicographically earliest sequence of distinct numbers such that a(n-1)+a(n) is not prime.

Original entry on oeis.org

0, 1, 3, 5, 4, 2, 6, 8, 7, 9, 11, 10, 12, 13, 14, 16, 17, 15, 18, 20, 19, 21, 23, 22, 24, 25, 26, 28, 27, 29, 31, 32, 30, 33, 35, 34, 36, 38, 37, 39, 41, 40, 42, 43, 44, 46, 45, 47, 48, 50, 49, 51, 53, 52, 54, 56, 55, 57, 58, 59, 60, 61, 62, 63, 65, 64, 66
Offset: 1

Views

Author

N. J. A. Sloane, Feb 01 2015, based on a suggestion from Patrick Devlin

Keywords

Comments

Conjecture: this is a permutation of the nonnegative numbers. [Proof outline below due to Patrick Devlin and Semeon Artamonov]
Let x be a number that's missing.
Then eventually every term must be of the form PRIME - x. (Otherwise, x would appear as that next term.)
In particular, this means there are only finitely many multiples of x that appear in the sequence. Let Y be a multiple of x larger than all multiples of x appearing in the sequence.
Let q be a prime not dividing Y. Then since none of the terms Y, 2Y, 3Y, ..., 2qY appear, it must be that, eventually, every term in the sequence is of the form PRIME - Y and also of the form PRIME - 2Y and also of the form PRIME - 3Y, ... and also of the form PRIME - 2qY.
That means we have a prime p and a number Y such that p, p+Y, p+2Y, p + 3Y, p+4Y, ..., p+2qY are all prime. But take this sequence mod q. Since q does not divide Y, the terms 0, Y, ..., 2qY cover every residue class mod q twice. Therefore, p + kY covers each residue class mod q twice. Consequently, there are two terms congruent to 0 mod q. One can be q, but the other must be a multiple of it (contradicting its primality).
Essentially the same as A055266. - R. J. Mathar, Feb 13 2015
Simplified version of the proof: Assume x isn't in the sequence, then eventually all terms must be of the form PRIME - x, else x would appear next. In particular, no multiple of x can appear from there on. Assume k*x is the largest multiple of x in the sequence. Take a prime p not dividing x. Then m*x can't appear in the sequence for k+1 <= m <= k+p, and all terms are eventually of the form PRIME - m*x for all m in {k+1, ..., k+p}. Take one such term N > p, i.e., N + (k+1)*x, ..., N + (k+p)*x are all prime. Consider this sequence mod p. Since gcd(x,p)=1, the p terms cover each residue class mod p, so one is a multiple of p, in contradiction with their primality. - M. F. Hasler, Nov 25 2019

Crossrefs

Programs

  • Haskell
    a253074 n = a253074_list !! (n-1)
    a253074_list = 0 : f 0 [1..] where
       f u vs = g vs where
         g (w:ws) | a010051' (u + w) == 1 = g ws
                  | otherwise = w : f w (delete w vs)
    -- Reinhard Zumkeller, Feb 02 2015
    
  • PARI
    A253074_upto(n=99, a, u, U)={vector(n,n, for(k=u,oo, bittest(U,k-u)|| isprime(a+k)||[a=k,break]); (a>u && U+=1<<(a-u))|| U>>=-u+u+=valuation(U+2,2); a)+if(default(debug),print([u]))} \\ additional args allow to tweak computation. If debug > 0, print least unused number at the end. - M. F. Hasler, Nov 25 2019

A054408 a(n) = smallest positive integer not already in sequence such that the partial sum a(1)+...+a(n) is prime.

Original entry on oeis.org

2, 1, 4, 6, 10, 8, 12, 16, 14, 24, 30, 22, 18, 26, 34, 36, 20, 28, 38, 40, 32, 42, 46, 48, 44, 52, 56, 60, 54, 58, 66, 50, 64, 62, 70, 84, 90, 72, 92, 76, 86, 94, 74, 88, 68, 82, 80, 102, 96, 100, 114, 98, 78, 112, 120, 110, 108, 106, 126, 122, 130, 132, 134, 124, 128, 118
Offset: 1

Views

Author

Henry Bottomley, May 09 2000

Keywords

Comments

1 is the only odd number in this sequence. - Derek Orr, Feb 07 2015
Conjecture: Every even numbers appears. - N. J. A. Sloane, May 29 2017

Crossrefs

Cf. A254337.
See A073659 for another version.
In A055265 only pairs of adjacent terms add to primes.

Programs

  • Mathematica
    t = {2}; Do[i = 1; While[! PrimeQ[Total[t] + i] || MemberQ[t, i], i++]; AppendTo[t, i], {65}]; t (* Jayanta Basu, Jul 04 2013 *)
  • PARI
    v=[2];n=1;while(n<100,if(isprime(vecsum(v)+n)&&!vecsearch(vecsort(v),n),v=concat(v,n);n=0);n++);v \\ Derek Orr, Feb 07 2015
    
  • Python
    from sympy import isprime
    def aupton(terms):
        alst, aset, asum = [], set(), 0
        while len(alst) < terms:
            an = 1
            while True:
                while an in aset: an += 1
                if isprime(asum + an):
                    alst, aset, asum = alst + [an], aset | {an}, asum + an
                    break
                an += 1
        return alst
    print(aupton(66)) # Michael S. Branicky, Jun 05 2021

A025043 a(n) is not of the form prime + a(k), k < n.

Original entry on oeis.org

0, 1, 9, 10, 25, 34, 35, 49, 55, 85, 91, 100, 115, 121, 125, 133, 145, 155, 169, 175, 187, 195, 205, 217, 235, 247, 253, 259, 265, 289, 295, 301, 309, 310, 319, 325, 335, 343, 355, 361, 375, 385, 391, 395, 403, 415, 425, 445, 451, 469, 475, 481, 485, 493, 505, 511, 515
Offset: 1

Views

Author

Keywords

Comments

Since this sequence includes 0 no terms are prime. - Charles R Greathouse IV, Jul 25 2013
Lexicographically earliest sequence of distinct natural numbers such that no two terms differ by a prime. - Peter Munn, Jun 19 2017
Congruence analysis from Peter Munn, Jun 30 2017: (Start)
If a(k) is in congruence class q mod p for some prime p, a(k) + p is the only higher number in this class that can be written as prime + a(k). Thus the ways a number m can be written as prime + a(k) for some k are much constrained if m shares membership of one or more such congruence classes with all except a few of the smaller terms in the sequence.
Of the first 100 terms, congruence class 1 mod 2 (odd numbers) contains 95, 1 mod 3 contains 76, and 0 mod 5 contains 53. No other congruence class modulo a prime contains more than 23.
The only even terms up to a(10000) are 0, 10, 34, 100, 310; of which 10, 100 and 310 are congruent to 10 mod 30, therefore to both 1 mod 3 and 0 mod 5. Note an initial sparseness of terms not congruent to either 1 mod 3 or 0 mod 5: this subsequence starts 9, 309, 527, 899, 989, 999. It becomes less sparse: as a proportion of the main sequence it is 0.04, 0.086 and 0.1555 of the first 100, 1000 and 10000 terms respectively.
Conjecture: there are only finitely many even terms.
(End)

Crossrefs

A025044 a(n) not of form prime - a(k), k < n.

Original entry on oeis.org

0, 1, 8, 14, 20, 24, 25, 26, 32, 38, 44, 50, 56, 62, 68, 74, 80, 86, 90, 92, 94, 98, 104, 110, 116, 118, 120, 122, 128, 134, 140, 144, 146, 152, 158, 160, 164, 170, 176, 182, 184, 188, 194, 200, 206, 212, 218, 220, 224, 230, 234, 236, 242, 248, 254, 260, 264, 266, 272, 274
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    a1 = {0}; nmax = 275; Do[ If[Select[n + a1, PrimeQ] == {}, AppendTo[a1, n]] , {n, nmax}]; a1 (* Ray Chandler, Jan 15 2017 *)

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

A254341 Lexicographically earliest sequence of distinct numbers with alternating parity such that no sum of consecutive terms is prime.

Original entry on oeis.org

0, 1, 8, 25, 24, 27, 6, 9, 30, 15, 42, 39, 18, 21, 36, 33, 60, 35, 16, 69, 48, 63, 12, 51, 66, 45, 72, 87, 54, 93, 78, 81, 90, 57, 84, 75, 114, 111, 96, 99, 120, 105, 102, 117, 144, 123, 108, 129, 126, 135, 138, 147, 150, 141, 162, 153, 156, 159, 132, 171, 174, 165, 168, 177, 192, 183, 180, 189, 186, 195, 198, 207, 204, 201, 216, 213, 228, 219, 210, 231, 222, 249, 240, 237, 252, 243, 258, 255, 234, 261, 246, 225, 288, 267, 264, 273, 276, 279, 270
Offset: 0

Views

Author

M. F. Hasler, Jan 29 2015

Keywords

Comments

In other words, no sum a(i)+a(i+1)+a(i+2)+...+a(j) may be prime. In particular, the sequence may not contain any primes.
Without the condition that the parity alternates, it seems that the sequence (A254337) contains only a single odd number.
It appears that a(n) ~ 3n. Is there a simple explanation for this?

Crossrefs

Programs

  • PARI
    {N=10^3; a=[]; u=0; for(i=0,N, a=concat(a,i%2); until( ! isprime(s) || ! a[#a]+=2, while( isprime(a[#a]) || bittest(u,a[#a]), a[#a]+=2);  s=a[k=#a]; while( k>1 && ! isprime( s+=a[k--]),)); u+=2^a[#a])}

A357579 Lexicographically earliest sequence of distinct numbers such that no sum of consecutive terms is a square or higher power of an integer.

Original entry on oeis.org

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

Views

Author

Carl Witthoft, Oct 03 2022

Keywords

Comments

This is inspired by sequence A254337, where sums equal to prime numbers are disallowed.
An unproved conjecture (for the present sequence) is that all integers which are not nontrivial powers will eventually appear.

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.
		

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
    

A153136 Smallest sequence of primes such that no sum of at least two terms is prime.

Original entry on oeis.org

2, 7, 13, 43, 103, 1627, 25349, 315743, 7338823, 42939980423
Offset: 1

Views

Author

Benoit Jubin, Dec 19 2008

Keywords

Crossrefs

Programs

  • PARI
    a=[];for(n=1,10, forprime(p=2,,setsearch(a,p)&&next;for(i=1,2^#a-1,isprime(normlp(vecextract(a,i),1)+p)&&next(2));a=concat(a,p);print1(p","))) \\ Very simplistic, should at least avoid an odd number of odd primes in the partial sum of earlier terms. \\ M. F. Hasler, Jan 29 2015

Extensions

a(8)-a(10) from Donovan Johnson, Dec 23 2008

A072545 a(0) = 1, a(n) for n > 0 is the smallest number > a(n-1) such that a(n)-a(k) is nonprime for 0 <= k < n.

Original entry on oeis.org

1, 2, 10, 11, 26, 35, 36, 50, 56, 86, 92, 101, 116, 122, 126, 134, 146, 156, 170, 176, 188, 196, 206, 218, 236, 248, 254, 260, 266, 290, 296, 302, 310, 311, 320, 326, 336, 344, 356, 362, 376, 386, 392, 396, 404, 416, 426, 446, 452, 470, 476, 482, 486, 494
Offset: 0

Views

Author

Amarnath Murthy, Aug 04 2002

Keywords

Comments

a(0) = 1, a(3) = 11, a(5) = 35, a(11) = 101 and a(33) = 311 are the only odd elements <= 10^6 and probably the only ones. If so, then for n >= 34, a(n) is the smallest even k >= a(n-1)+4 for which none of k-1, k-11, k-35, k-101 or k-311 is prime. - David W. Wilson, Dec 14 2006

Examples

			26 is the smallest number > 11 which differs from 1, 2, 10, 11 by a nonprime (25, 24, 16, 15), so 26 is the next term after 11.
		

Crossrefs

Programs

  • PARI
    print1(a=1,","); v=[1]; n=1; while(n<55,a++; k=1; while(k<=n&&!isprime(a-v[k]), k++); if(k>n,n++; v=concat(v,a); print1(a,",")))

Extensions

Edited and extended by Klaus Brockhaus, Aug 09 2002
Showing 1-10 of 13 results. Next