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-7 of 7 results.

A263351 Fixed points of A243625: integers n such that A243625(n)=n.

Original entry on oeis.org

1, 4, 9, 18, 23, 48, 54, 60, 63, 77, 91, 92, 93, 104, 117, 126, 129, 137, 151, 152, 153, 167, 169, 214, 229, 239, 255, 256, 264, 266, 267, 270, 282, 285, 289, 293, 295, 297, 326, 342, 344, 345, 348, 350, 355, 364, 400, 420, 428, 436, 439, 440, 447, 454, 458
Offset: 1

Views

Author

Zak Seidov, Oct 16 2015

Keywords

Comments

Among first 1000 terms of A243625 there are 124 fixed points.
Almost certainly A243625 is a permutation of natural numbers.
And almost certainly there is no (easy) proof of it.

Crossrefs

Cf. A243625.

Programs

  • Maple
    with(numtheory):
    b:= proc(n) is(n=1) end: h:= 2:
    g:= proc(n) option remember; global h; local k, t;
          if n=1 then 1 else t:=g(n-1);
             for k from h while b(k) or bigomega(t+k)<>2
             do od; b(k):=true; while b(h) do h:=h+1 od; k
          fi
        end:
    a:= proc(n) option remember; local k;
          for k from 1+`if`(n=1, 0, a(n-1)) do
            if g(k)=k then break fi
          od: k
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Oct 17 2015
  • Mathematica
    b[n_] := n == 1;
    h = 2;
    g[n_] := g[n] = Module[{k, t}, If[n == 1, 1,  t = g[n - 1]; For[k = h, b[k] || PrimeOmega[t + k] != 2, k++]; b[k] = True; While[b[h], h++]; k]];
    a[n_] := a[n] = Module[{k}, For[k = 1 + If[n == 1, 0, a[n - 1]], True, k++, If[g[k] == k, Break[]]]; k];
    Array[a, 100] (* Jean-François Alcover, Nov 23 2020, after Alois P. Heinz *)

A055265 a(n) is the smallest positive integer not already in the sequence such that a(n)+a(n-1) is prime, starting with a(1)=1.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, May 09 2000

Keywords

Comments

The sequence is well-defined (the terms must alternate in parity, and by Dirichlet's theorem a(n+1) always exists). - N. J. A. Sloane, Mar 07 2017
Does every positive integer eventually occur? - Dmitry Kamenetsky, May 27 2009. Reply from Robert G. Wilson v, May 27 2009: The answer is almost certainly yes, on probabilistic grounds.
It appears that this is the limit of the rows of A051237. That those rows do approach a limit seems certain, and given that that limit exists, that this sequence is the limit seems even more likely, but no proof is known for either conjecture. - Robert G. Wilson v, Mar 11 2011, edited by Franklin T. Adams-Watters, Mar 17 2011
The sequence is also a particular case of "among the pairwise sums of any M consecutive terms, N are prime", with M = 2, N = 1. For other M, N see A055266 & A253074 (M = 2, N = 0), A329333, A329405 - A329416, A329449 - A329456, A329563 - A329581, and the OEIS Wiki page. - M. F. Hasler, Feb 11 2020

Examples

			a(5) = 7 because 1, 2, 3 and 4 have already been used and neither 4 + 5 = 9 nor 4 + 6 = 10 are prime while 4 + 7 = 11 is prime.
		

Crossrefs

Inverse permutation: A117922; fixed points: A117925; A117923=a(a(n)). - Reinhard Zumkeller, Apr 03 2006
Cf. A086527 (the primes a(n)+a(n-1)).
Cf. A070942 (n's such that a(1..n) is a permutation of (1..n)). - Zak Seidov, Oct 19 2011
See also A076990, A243625.
See A282695 for deviation from identity sequence.
A073659 is a version where the partial sums must be primes.

Programs

  • Haskell
    import Data.List (delete)
    a055265 n = a055265_list !! (n-1)
    a055265_list = 1 : f 1 [2..] where
       f x vs = g vs where
         g (w:ws) = if a010051 (x + w) == 1
                       then w : f w (delete w vs) else g ws
    -- Reinhard Zumkeller, Feb 14 2013
    
  • Maple
    A055265 := proc(n)
        local a,i,known ;
        option remember;
        if n =1 then
            1;
        else
            for a from 1 do
                known := false;
                for i from 1 to n-1 do
                    if procname(i) = a then
                        known := true;
                        break;
                    end if;
                end do:
                if not known and isprime(procname(n-1)+a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A055265(n),n=1..100) ; # R. J. Mathar, Feb 25 2017
  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[ -1]]}, While[ MemberQ[s, k] || ! PrimeQ[a + k], k++ ]; Append[s, k]]; Nest[f, {1}, 71] (* Robert G. Wilson v, May 27 2009 *)
    q=2000; a={1}; z=Range[2,2*q]; While[Length[z]>q-1, k=1; While[!PrimeQ[z[[k]]+Last[a]], k++]; AppendTo[a,z[[k]]]; z=Delete[z,k]]; Print[a] (*200 times faster*) (* Vladimir Joseph Stephan Orlovsky, May 03 2011 *)
  • PARI
    v=[1];n=1;while(n<50,if(isprime(v[#v]+n)&&!vecsearch(vecsort(v),n), v=concat(v,n);n=0);n++);v \\ Derek Orr, Jun 01 2015
    
  • PARI
    U=-a=1; vector(100,k, k=valuation(1+U+=1<M. F. Hasler, Feb 11 2020

Formula

a(2n-1) = A128280(2n-1) - 1, a(2n) = A128280(2n) + 1, for all n >= 1. - M. F. Hasler, Feb 11 2020

Extensions

Corrected by Hans Havermann, Sep 24 2002

A284049 a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) is a prime power, with a(1) = 1.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Mar 19 2017

Keywords

Comments

Conjectured to be a permutation of the natural numbers.

Examples

			a(8) = 9 because 1, 2, 3, 4, 5, 6 and 7 have already been used in the sequence, 7 + 8 = 15 is not prime power while 7 + 9 = 16 is a prime power.
		

Crossrefs

Programs

  • Maple
    N:= 100: # to get all terms before the first term > N
    S:= [$2..N]:
    a[1]:= 1: found:= true:
    for n from 2 while found do
      found:= false;
      for j from 1 to nops(S) do
        if ispp(a[n-1]+S[j]) then
          found:= true;
          a[n]:= S[j];
          S:= subsop(j=NULL,S);
          break
        fi
      od;
    od:
    seq(a[i],i=1..n-2); # Robert Israel, Apr 16 2017
  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[-1]]}, While[MemberQ[s, k] || ! PrimePowerQ[a + k], k++]; Append[s, k]]; Nest[f, {1}, 80]

A284048 a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) is a proper prime power (A246547), with a(1) = 1.

Original entry on oeis.org

1, 3, 5, 4, 12, 13, 14, 2, 6, 10, 15, 17, 8, 19, 30, 34, 47, 74, 7, 9, 16, 11, 21, 28, 36, 45, 76, 49, 32, 89, 39, 25, 24, 40, 41, 23, 26, 38, 43, 78, 50, 31, 18, 46, 35, 29, 20, 44, 37, 27, 22, 42, 79, 90, 153, 103, 66, 55, 70, 51, 77, 48, 33, 88, 81, 162, 94, 75, 53, 68, 57, 64, 61, 60, 65, 56, 69, 52, 73, 96, 147
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 19 2017

Keywords

Examples

			a(5) = 12 because 1, 3, 4 and 5 have already been used in the sequence, 4 + 2 = 6, 4 + 6 = 10, 4 + 7 = 11, 4 + 8 = 12, 4 + 9 = 13, 4 + 10 = 14 and 4 + 11 = 15 are not proper prime powers while 4 + 12 = 16 is a proper prime power.
		

Crossrefs

Programs

  • Maple
    N:= 2000: # to get all terms before the first where a(n)+a(n-1)>N
    PP:= {seq(seq(p^j, j =2..floor(log[p](N))),p = select(isprime,[2,seq(i,i=3..floor(sqrt(N)),2)]))}:
    PP:= sort(convert(PP,list)):
    V:= Vector(N,datatype=integer[1],1):
    A[1]:= 1; V[1]:= 0;
    for n from 2 do
      for pp in PP do
        t:= pp - A[n-1];
        if t > 0 and V[t] = 1 then
          A[n]:= t; V[t]:= 0; break
        fi;
      od;
      if not assigned(A[n]) then break fi
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Apr 24 2017
  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[-1]]}, While[MemberQ[s, k] || ! (PrimePowerQ[a + k] && PrimeOmega[a + k] > 1), k++];Append[s, k]]; Nest[f, {1}, 80]

A263349 a(n) = smallest number > a(n-1) such that a(n-1) + a(n) is a semiprime (A001358), a(1)=1.

Original entry on oeis.org

1, 3, 6, 8, 13, 20, 26, 29, 33, 36, 38, 39, 43, 44, 47, 48, 58, 60, 61, 62, 67, 74, 81, 85, 92, 93, 94, 100, 101, 102, 103, 106, 107, 108, 109, 110, 111, 115, 120, 127, 132, 133, 134, 140, 147, 148, 150, 151, 152, 153, 156, 158, 161, 162, 164, 165
Offset: 1

Views

Author

Zak Seidov, Oct 15 2015

Keywords

Comments

Similar sequences with any other initial a(1) will eventually merge with case a(1)=1.

Examples

			1 + 3 = 4 = 2*2, 3 + 6 = 9 = 3*3, 6 + 8 = 14 = 2*7, etc.
		

Crossrefs

Programs

  • Mathematica
    s={a=1};Do[k=a+1;While[PrimeOmega[a+k]!=2,k++];AppendTo[s,a=k],{100}];s
  • PARI
    lista(nn) = {print1(a = 1, ", "); for (k=1, nn, na = a+1; while (bigomega(a+na) != 2, na++); a = na; print1(a, ", "););} \\ Michel Marcus, Oct 17 2015

A284047 a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) and a(n)^2 + a(n-1)^2 are primes, with a(1) = 1.

Original entry on oeis.org

1, 2, 3, 8, 5, 6, 11, 20, 23, 18, 35, 24, 19, 10, 7, 12, 17, 42, 25, 4, 9, 14, 15, 22, 57, 32, 27, 52, 37, 30, 13, 28, 33, 40, 39, 34, 45, 16, 31, 70, 69, 80, 21, 26, 41, 56, 51, 50, 53, 48, 65, 36, 71, 60, 29, 44, 59, 54, 85, 46, 81, 100, 49, 90, 61, 76, 91, 66, 101, 96, 55, 58, 73, 108, 43, 120, 79, 84, 145, 78, 103
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 19 2017

Keywords

Comments

Conjectured to be a permutation of the natural numbers.

Examples

			a(4) = 8 because 1, 2 and 3 have already been used in the sequence, 3 + 4 = 7 is a prime but 3^2 + 4^2 = 25 is not prime, 3 + 5 = 8, 3 + 6 = 9, 3 + 7 = 10 are not primes while 3 + 8 = 11 is a prime and 3^2 + 8^2 = 73 is a prime also.
		

Crossrefs

Programs

  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[-1]]}, While[MemberQ[s, k] || ! (PrimeQ[a + k] && PrimeQ[a^2 + k^2]), k++]; Append[s, k]]; Nest[f, {1}, 80]

A344093 a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) is the product of two distinct primes, with a(1) = 1.

Original entry on oeis.org

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

Views

Author

Atticus Stewart, Aug 15 2021

Keywords

Comments

This sequence is not to be confused with A243625 (similar but with "semiprime" instead of "product of two distinct primes"). This sequence omits squares of primes, whereas semiprimes include them. This sequence is also similar to A055625, in which sums of consecutive terms are primes instead of semiprimes.
Interestingly, the first 9 terms are a permutation of the first 9 positive integers. This is also true for the first 12, 21, 30, and 48 terms, and possibly higher values as well. This suggests that every positive integer occurs, but this is unproved.

Examples

			a(4) = 6 because 6 is the smallest k such that a(3) + k is the product of two distinct primes.
		

Crossrefs

Programs

  • Mathematica
    a[1]=1;a[n_]:=a[n]=(k=1;While[MemberQ[Array[a,n-1],k]||Last/@FactorInteger[a[n-1]+k]!={1,1},k++];k);Array[a,100] (* Giorgos Kalogeropoulos, Aug 16 2021 *)
  • Python
    terms = [1]
    previous = 1
    def isValid(num):
      counter = 0
      for possibleDiv in range(1, int(math.sqrt(num)) + 1):
        if num % possibleDiv == 0:
          counter += 1
          if num/possibleDiv % possibleDiv == 0 and possibleDiv != 1:
            return False
        if counter > 2:
          return False
      if counter == 2:
        return True
      return False
    def generateSequence(numOfTerms):
      for i in range(numOfTerms):
        testNum = 1
        valid = False
        while not valid:
          if testNum not in terms:
            possibleNum = previous + testNum
            if isValid(num):
              valid = True
              terms.append(testNum)
              previous = testNum
          testNum += 1
Showing 1-7 of 7 results.