A075542 Duplicate of A064113.
2, 15, 36, 39, 46, 54, 55, 73, 102, 107, 110, 118, 129, 160, 164, 184, 187, 194, 199
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.
Triangle starts: 00: 1; 01: 1; 02: 2; 03: 2, 2; 04: 3, 4, 1; 05: 2, 10, 4; 06: 4, 12, 14, 2; 07: 2, 22, 29, 10, 1; 08: 4, 26, 56, 36, 6; 09: 3, 34, 100, 86, 31, 2; 10: 4, 44, 148, 200, 99, 16, 1; 11: 2, 54, 230, 374, 278, 78, 8; 12: 6, 58, 322, 680, 654, 274, 52, 2; 13: 2, 74, 446, 1122, 1390, 814, 225, 22, 1; 14: 4, 88, 573, 1796, 2714, 2058, 813, 136, 10; 15: 4, 88, 778, 2694, 4927, 4752, 2444, 618, 77, 2; 16: 5, 110, 953, 3954, 8531, 9930, 6563, 2278, 415, 28, 1; ... Row n=5 is 2, 10, 4 because in the 16 compositions of 5 ##: [composition] no. of changes 01: [ 1 1 1 1 1 ] 0 02: [ 1 1 1 2 ] 1 03: [ 1 1 2 1 ] 2 04: [ 1 1 3 ] 1 05: [ 1 2 1 1 ] 2 06: [ 1 2 2 ] 1 07: [ 1 3 1 ] 2 08: [ 1 4 ] 1 09: [ 2 1 1 1 ] 1 10: [ 2 1 2 ] 2 11: [ 2 2 1 ] 1 12: [ 2 3 ] 1 13: [ 3 1 1 ] 1 14: [ 3 2 ] 1 15: [ 4 1 ] 1 16: [ 5 ] 0 there are 2 with no changes, 10 with one change, and 4 with two changes.
b:= proc(n, v) option remember; `if`(n=0, 1, expand( add(b(n-i, i)*`if`(v=0 or v=i, 1, x), i=1..n))) end: T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)): seq(T(n), n=0..14);
b[n_, v_] := b[n, v] = If[n == 0, 1, Expand[Sum[b[n-i, i]*If[v == 0 || v == i, 1, x], {i, 1, n}]]]; T[n_] := Function[{p}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0]]; Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Feb 11 2015, after Maple *) Table[If[n==0,1,Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[Split[#]]==k+1&]]],{n,0,12},{k,0,If[n==0,0,Floor[2*(n-1)/3]]}] (* Gus Wiseman, Apr 10 2020 *)
T_xy(max_row) = {my(N=max_row+1, x='x+O('x^N),h=(1+ sum(i=1,N,(x^i-y*x^i)/(1+y*x^i-x^i)))/(1-sum(i=1,N, y*x^i/(1+y*x^i-x^i)))); for(n=0,N-1, print(Vecrev(polcoeff(h,n))))} T_xy(16) \\ John Tyler Rascoe, Jul 10 2024
T(4,1) = 3 because the compositions of 4 with 1 adjacent equal part are 1+1+2, 2+1+1, 2+2. Triangle begins: 1; 1, 1; 3, 0, 1; 4, 3, 0, 1; 7, 6, 2, 0, 1; 14, 7, 8, 2, 0, 1; 23, 20, 10, 8, 2, 0, 1; ... From _Gus Wiseman_, Mar 23 2020 (Start) Row n = 6 counts the following compositions (empty column shown by dot): (6) (33) (222) (11112) . (111111) (15) (114) (1113) (21111) (24) (411) (1122) (42) (1131) (2211) (51) (1221) (3111) (123) (1311) (11121) (132) (2112) (11211) (141) (12111) (213) (231) (312) (321) (1212) (2121) (End)
b:= proc(n, h, t) option remember; if n=0 then `if`(t=0, 1, 0) elif t<0 then 0 else add(b(n-j, j, `if`(j=h, t-1, t)), j=1..n) fi end: T:= (n, k)-> b(n, -1, k): seq(seq(T(n, k), k=0..n-1), n=1..15); # Alois P. Heinz, Oct 23 2011
b[n_, h_, t_] := b[n, h, t] = If[n == 0, If[t == 0, 1, 0], If[t<0, 0, Sum[b[n-j, j, If [j == h, t-1, t]], {j, 1, n}]]]; T[n_, k_] := b[n, -1, k]; Table[Table[T[n, k], {k, 0, n-1}], {n, 1, 15}] // Flatten (* Jean-François Alcover, Feb 20 2015, after Alois P. Heinz *) Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],n==0||Length[Split[#,#1!=#2&]]==k+1&]],{n,0,12},{k,0,n}] (* Gus Wiseman, Mar 23 2020 *)
5 belongs to the sequence because 5 = (3 + 7)/2. Likewise 53 = (47 + 59)/2. 5 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (3, 5, 7). 53 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (47, 53, 59). 257 and 263 belong to the sequence because they are terms, but not first or last, of the AP of consecutive primes (251, 257, 263, 269).
a006562 n = a006562_list !! (n-1) a006562_list = filter ((== 1) . a010051) a075540_list -- Reinhard Zumkeller, Jan 20 2012
a006562 n = a006562_list !! (n-1) a006562_list = h a000040_list where h (p:qs@(q:r:ps)) = if 2 * q == (p + r) then q : h qs else h qs -- Reinhard Zumkeller, May 09 2013
[a: n in [1..1000] | IsPrime(a) where a is NthPrime(n)-NthPrime(n+1)+NthPrime(n+2)]; // Vincenzo Librandi, Jun 23 2016
Transpose[ Select[ Partition[ Prime[ Range[1000]], 3, 1], #[[2]] ==(#[[1]] + #[[3]])/2 &]][[2]] p=Prime[Range[1000]]; p[[Flatten[1+Position[Differences[p, 2], 0]]]] Prime[#]&/@SequencePosition[Differences[Prime[Range[800]]],{x_,x_}][[All,2]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 31 2019 *)
betwixtpr(n) = { local(c1,c2,x,y); for(x=2,n, c1=c2=0; for(y=prime(x-1)+1,prime(x)-1, if(!isprime(y),c1++); ); for(y=prime(x)+1,prime(x+1)-1, if(!isprime(y),c2++); ); if(c1==c2,print1(prime(x)",")) ) } \\ Cino Hilliard, Jan 25 2005
forprime(p=1,999, p-precprime(n-1)==nextprime(p+1)-p && print1(p",")) \\ M. F. Hasler, Jun 01 2013
is(n)=n-precprime(n-1)==nextprime(n+1)-n && isprime(n) \\ Charles R Greathouse IV, Apr 07 2016
from sympy import nextprime; p, q, r = 2, 3, 5 while q < 6000: if 2*q == p + r: print(q, end = ", ") p, q, r = q, r, nextprime(r) # Ya-Ping Lu, Dec 23 2021
a(3) = 5 + 11 - 2*7 = 16 - 14 = 2.
a036263 n = a036263_list !! (n-1) a036263_list = zipWith (-) (tail a001223_list) a001223_list -- Reinhard Zumkeller, Oct 29 2011
A036263:=n->ithprime(n) + ithprime(n+2) - 2*ithprime(n+1); seq(A036263(n), n=1..100); # Wesley Ivan Hurt, Apr 01 2014
Table[Prime[n - 1] + Prime[n + 1] - 2*Prime[n], {n, 2, 105}] Differences[Prime[Range[100]], 2] (* Harvey P. Dale, Oct 14 2012 *)
for(n=2,100,print1(prime(n+2)-2*prime(n+1)+prime(n)","))
from sympy import prime def A036263(n): return prime(n)-(prime(n+1)<<1)+prime(n+2) # Chai Wah Wu, Sep 28 2024
The prime gaps split into the following runs: (1), (2,2), (4), (2), (4), (2), (4), (6), (2), (6), (4), (2), (4), (6,6), (2), (6), (4), ...
p:= 3: t:= 1: R:= NULL: s:= 1: count:= 0: for i from 2 while count < 100 do q:= nextprime(p); g:= q-p; p:= q; if g = t then s:= s+1 else count:= count+1; R:= R, s; t:= g; s:= 1; fi od: R; # Robert Israel, Jan 06 2021
Length/@Split[Differences[Array[Prime,100]],#1==#2&]//Most
The nonsquarefree numbers (A013929) are: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, 28, 32, 36, 40, 44, 45, 48, 49, 50, 52, ... with first differences (A078147): 4, 1, 3, 4, 2, 2, 4, 1, 2, 1, 4, 4, 4, 4, 1, 3, 1, 1, 2, 2, 2, 4, 3, 1, 4, 4, ... with first differences (A376593): -3, 2, 1, -2, 0, 2, -3, 1, -1, 3, 0, 0, 0, -3, 2, -2, 0, 1, 0, 0, 2, -1, -2, ...
Differences[Select[Range[100],!SquareFreeQ[#]&],2]
from math import isqrt from sympy import mobius, factorint def A376593(n): def f(x): return n+sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1)) m, k = n, f(n) while m != k: m, k = k, f(k) k = next(i for i in range(1,5) if any(d>1 for d in factorint(m+i).values())) return next(i for i in range(1-k,5-k) if any(d>1 for d in factorint(m+(k<<1)+i).values())) # Chai Wah Wu, Oct 02 2024
a037201 n = a037201_list !! (n-1) a037201_list = f a001223_list where f (x:xs@(x':_)) | x == x' = f xs | otherwise = x : f xs -- Reinhard Zumkeller, Feb 27 2012
Flatten[Split[Differences[Prime[Range[150]]]]/.{(k_)..}:>k] (* based on a program by Harvey P. Dale, Jun 21 2012 *)
t=0;p=2;forprime(q=3,1e3,if(q-p!=t,print1(q-p", "));t=q-p;p=q) \\ Charles R Greathouse IV, Feb 27 2012
The sequence of differences between primes splits into the following runs: (1), (2,2), (4), (2), (4), (2), (4), (6), (2), (6), (4), (2), (4), (6,6), (2), (6), (4), (2), (6), (4), (6).
Accumulate[Length/@Split[Differences[Array[Prime,100]],#1==#2&]]//Most - or - Select[Range[100],Prime[#+1]-Prime[#]!=Prime[#+2]-Prime[#+1]&]
From _Gus Wiseman_, Oct 10 2024: (Start) The composite numbers (A002808) are: 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, ... with first differences (A073783): 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, ... with first differences (A073445): 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 1, -1, ... (End)
a073445 n = a073445_list !! (n-1) a073445_list = zipWith (-) (tail a073783_list) a073783_list -- Reinhard Zumkeller, Jan 10 2013
c[x_] := FixedPoint[x+PrimePi[ # ]+1&, x]; Table[c[w+2]-2*c[w+1]+c[w], {w, 200}] (* second program *) Differences[Select[Range[100],CompositeQ],2] (* Gus Wiseman, Oct 08 2024 *)
from sympy import primepi def A073445(n): def iterfun(f,n=0): m, k = n, f(n) while m != k: m, k = k, f(k) return m return (a:=iterfun(f:=lambda x:n+primepi(x)+1,n))-((b:=iterfun(lambda x:f(x)+1,a))<<1)+iterfun(lambda x:f(x)+2,b) # Chai Wah Wu, Oct 03 2024
Comments