A065436 Duplicate of A055500.
1, 1, 2, 3, 5, 7, 11, 17, 23, 37, 59, 89, 139, 227, 359, 577, 929, 1499, 2423, 3919, 6337
Offset: 1
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.
b:= proc(n, t) option remember; `if`(n<3, n+1, (h-> `if`(t=1, prevprime(h), nextprime(h)))(t+b(n-1, t)+b(n-2, t))) end: a:= n-> b(n,-1)-b(n,1): seq(a(n), n=1..50); # Alois P. Heinz, May 12 2023
b[n_, t_] := b[n, t] = If[n < 3, n+1, Function[h, If[t == 1, NextPrime[h, -1], NextPrime[h]]][t + b[n-1, t] + b[n-2, t]]]; a[n_] := If[n == 0, -1, b[n-1, -1] - b[n-1, 1]]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, May 19 2024, after Alois P. Heinz *)
After 3, 5, the next prime >=8 is 11.
a055498 n = a055498_list !! n a055498_list = 0 : 1 : map a007918 (zipWith (+) a055498_list $ tail a055498_list) -- Reinhard Zumkeller, Nov 13 2014
a[0] = 0; a[1] = 1; a[n_] := a[n] = NextPrime[a[n - 1] + a[n - 2] -1]; Array[a, 37, 0] (* Robert G. Wilson v, Mar 13 2013 *) RecurrenceTable[{a[0]==0,a[1]==1,a[n]==NextPrime[a[n-1]+a[n-2]-1]},a,{n,50}] (* Harvey P. Dale, May 08 2013 *)
a(n)=local(v);if(n<2,n>=0,n++;v=vector(n,i,1);for(i=3,n,v[i]=nextprime(v[i-1]+v[i-2]));v[n]) /* Michael Somos, Feb 01 2004 */
41 can be expressed as 41 or 11+13+17 or 2+3+5+7+11+13, so 41 is in the sequence.
N:= 10^4: # to get all terms <= N P:= [0,op(select(isprime, [2,seq(i,i=3..N,2)]))]: nP:= nops(P); S:= ListTools:-PartialSums(P): V:= Vector(N): for i from 1 to nP-1 do for j from i+1 to nP while S[j] - S[i] <= N do V[S[j]-S[i]]:= V[S[j]-S[i]]+1 od od: select(t -> V[t] = 3, [$1..N]): # Robert Israel, Apr 05 2017
Module[{nn = 300, s}, s = Array[Prime, nn]; Keys@ Take[Select[KeySort@ Merge[Table[PositionIndex@ Map[Total, Partition[s, k, 1]], {k, nn/2}], Identity], Length@ # == 3 &], Floor[nn/6]]] (* Michael De Vlieger, Apr 06 2017, Version 10 *)
A055502 := proc(n) option remember; if n<=0 then n else nextprime(A055502(n-1)+A055502(n-2)); fi; end;
a[0] = 0; a[1] = 2; a[n_] := a[n] = NextPrime[a[n-1] + a[n-2]]; Array[a, 40, 0] (* Amiram Eldar, Sep 24 2023 *)
5 can be expressed as 5 or 2+3, so 5 is in the sequence.
a[0] = 0; a[1] = 1; a[n_] := a[n] = NextPrime[a[n - 1] + a[n - 2]]; Array[a, 36, 0] (* Robert G. Wilson v, Mar 13 2013 *)
Transpose[NestList[{#[[2]],NextPrime[Total[#],-1]}&,{1,2},40]][[1]] (* Harvey P. Dale, May 29 2013 *)
Comments