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 16 results. Next

A258713 A001172(n)/2: Least k such that 2k is a sum of two odd primes in exactly n ways.

Original entry on oeis.org

0, 3, 5, 11, 17, 24, 30, 39, 42, 45, 57, 72, 60, 84, 90, 117, 123, 144, 120, 105, 162, 150, 180, 237, 165, 264, 288, 195, 231, 240, 210, 285, 255, 336, 396, 378, 438, 357, 399, 345, 519, 315, 504, 465, 390, 480, 435, 462, 450, 567, 717, 420, 495, 651
Offset: 0

Views

Author

N. J. A. Sloane, Jun 14 2015

Keywords

Comments

Up to a(14) also indices of records in A002375, number of ways to write 2n as sum of two odd primes. - M. F. Hasler, Aug 21 2017

Crossrefs

Programs

  • Maple
    g:= add(x^ithprime(i),i=2..1000):
    G:= series((g^2+add(x^(2*ithprime(i)),i=2..1000))/2,x,ithprime(1001)+3):
    A[0]:= 0:
    for k from 1 to (ithprime(1001)+1)/2 do
      m:= coeff(G,x,2*k);
      if not assigned(A[m]) then A[m]:= k fi;
    od:
    for m from 1 while assigned(A[m]) do od:
    seq(A[i],i=0..m-1); # Robert Israel, Aug 21 2017
  • Mathematica
    With[{s = Array[Count[Select[IntegerPartitions[2 #, 2], Length@ # == 2 &], p_ /; AllTrue[p, And[PrimeQ@ #, OddQ@ #] &]] &, 10^3]}, Table[FirstPosition[s, n][[1]] /. 1 -> 0, {n, 0, 53}]] (* Michael De Vlieger, Aug 21 2017 *)

Extensions

Edited by M. F. Hasler, Aug 21 2017
Edited by Robert Israel, Aug 21 2017

A000666 Number of symmetric relations on n nodes.

Original entry on oeis.org

1, 2, 6, 20, 90, 544, 5096, 79264, 2208612, 113743760, 10926227136, 1956363435360, 652335084592096, 405402273420996800, 470568642161119963904, 1023063423471189431054720, 4178849203082023236058229792, 32168008290073542372004082199424
Offset: 0

Views

Author

Keywords

Comments

Each node may or may not be related to itself.
Also the number of rooted graphs on n+1 nodes.
The 1-to-1 correspondence is as follows: Given a rooted graph on n+1 nodes, replace each edge joining the root node to another node with a self-loop at that node and erase the root node. The result is an undirected graph on n nodes which is the graph of the symmetric relation.
Also the number of the graphs with n nodes whereby each node is colored or not colored. A loop can be interpreted as a colored node. - Juergen Will, Oct 31 2011

References

  • F. Harary and E. M. Palmer, Graphical Enumeration, Academic Press, NY, 1973, pp. 101, 241.
  • M. D. McIlroy, Calculation of numbers of structures of relations on finite sets, Massachusetts Institute of Technology, Research Laboratory of Electronics, Quarterly Progress Reports, No. 17, Sept. 15, 1955, pp. 14-22.
  • R. W. Robinson, Numerical implementation of graph counting algorithms, AGRC Grant, Math. Dept., Univ. Newcastle, Australia, 1976.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000595, A001172, A001174, A006905, A000250, A054921 (connected relations).

Programs

  • Maple
    # see Riedel link above
  • Mathematica
    Join[{1,2}, Table[CycleIndex[Join[PairGroup[SymmetricGroup[n]], Permutations[Range[n*(n-1)/2+1, n*(n+1)/2]], 2],s] /. Table[s[i]->2, {i,1,n^2-n}], {n,2,8}]] (* Geoffrey Critzer, Nov 04 2011 *)
    Table[Module[{eds,pms,leq},
    eds=Select[Tuples[Range[n],2],OrderedQ];
    pms=Map[Sort,eds/.Table[i->Part[#,i],{i,n}]]&/@Permutations[Range[n]];
    leq=Function[seq,PermutationCycles[Ordering[seq],Length]]/@pms;
    Total[Thread[Power[2,leq]]]/n!
    ],{n,0,8}] (* This is after Geoffrey Critzer's program but does not use the (deprecated) Combinatorica package. - Gus Wiseman, Jul 21 2016 *)
    permcount[v_] := Module[{m = 1, s = 0, k = 0, t}, For[i = 1, i <= Length[v], i++, t = v[[i]]; k = If[i > 1 && t == v[[i - 1]], k + 1, 1]; m *= t*k; s += t]; s!/m];
    edges[v_] := Sum[Sum[GCD[v[[i]], v[[j]]], {j, 1, i-1}], {i, 2, Length[v]}] + Sum[Quotient[v[[i]], 2] + 1, {i, 1, Length[v]}];
    a[n_] := a[n] = (s = 0; Do[s += permcount[p]*2^edges[p], {p, IntegerPartitions[n]}]; s/n!);
    Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 0, 17}] (* Jean-François Alcover, Nov 13 2017, after Andrew Howroyd *)
  • PARI
    permcount(v) = {my(m=1,s=0,k=0,t); for(i=1,#v,t=v[i]; k=if(i>1&&t==v[i-1],k+1,1); m*=t*k;s+=t); s!/m}
    edges(v) = {sum(i=2, #v, sum(j=1, i-1, gcd(v[i],v[j]))) + sum(i=1, #v, v[i]\2 + 1)}
    a(n) = {my(s=0); forpart(p=n, s+=permcount(p)*2^edges(p)); s/n!} \\ Andrew Howroyd, Oct 22 2017
    
  • Python
    from itertools import combinations
    from math import prod, factorial, gcd
    from fractions import Fraction
    from sympy.utilities.iterables import partitions
    def A000666(n): return int(sum(Fraction(1<>1)+1)*r+(q*r*(r-1)>>1) for q, r in p.items()),prod(q**r*factorial(r) for q, r in p.items())) for p in partitions(n))) # Chai Wah Wu, Jul 02 2024

Formula

Euler transform of A054921. - N. J. A. Sloane, Oct 25 2018
Let G_{n+1,k} be the number of rooted graphs on n+1 nodes with k edges and let G_{n+1}(x) = Sum_{k=0..n(n+1)/2} G_{n+1,k} x^k. Thus a(n) = G_{n+1}(1). Let S_n(x_1, ..., x_n) denote the cycle index for Sym_n. (cf. the link in A000142).
Compute x_1*S_n and regard it as the cycle index of a set of permutations on n+1 points and find the corresponding cycle index for the action on the n(n+1)/2 edges joining those points (the corresponding "pair group"). Finally, by replacing each x_i by 1+x^i gives G_{n+1}(x). [Harary]
Example, n=2. S_2 = (1/2)*(x_1^2+x_2), x_1*S_2 = (1/2)*(x_1^3+x_1*x_2). The pair group is (1/2)*(x_1^2+x_1*x_2) and so G_3(x) = (1/2)*((1+x)^3+(1+x)*(1+x^2)) = 1+2*x+2*x^2+x^3; set x=1 to get a(2) = 6.
a(n) ~ 2^(n*(n+1)/2)/n! [McIlroy, 1955]. - Vaclav Kotesovec, Dec 19 2016

Extensions

Description corrected by Christian G. Bower
More terms from Vladeta Jovovic, Apr 18 2000
Entry revised by N. J. A. Sloane, Mar 06 2007

A023036 Smallest positive even integer that is an unordered sum of two primes in exactly n ways.

Original entry on oeis.org

2, 4, 10, 22, 34, 48, 60, 78, 84, 90, 114, 144, 120, 168, 180, 234, 246, 288, 240, 210, 324, 300, 360, 474, 330, 528, 576, 390, 462, 480, 420, 570, 510, 672, 792, 756, 876, 714, 798, 690, 1038, 630, 1008, 930, 780, 960, 870, 924, 900, 1134, 1434, 840, 990, 1302, 1080
Offset: 0

Views

Author

David W. Wilson, Jun 14 1998

Keywords

Comments

Except for first two terms, same as A001172.
The first occurrence of k in A045917.
The graph looks like a comet. - Daniel Forgues, Jun 12 2014

Examples

			a(3) = 22 as 22 = (19+3) = (17+5) = (11+11). There are exactly 3 ways 22 can be expressed as the sum of two primes and no even number less than 22 can be so expressed.
From _Daniel Forgues_, Jun 13 2014: (Start)
Terms for n = 1..6 and corresponding sums:
  a(1) =  4 =  2 + 2;
  a(2) = 10 =  7 + 3 =  5 +  5;
  a(3) = 22 = 19 + 3 = 17 +  5 = 11 + 11;
  a(4) = 34 = 31 + 3 = 29 +  5 = 23 + 11 = 17 + 17;
  a(5) = 48 = 43 + 5 = 41 +  7 = 37 + 11 = 31 + 17 = 29 + 19;
  a(6) = 60 = 53 + 7 = 47 + 13 = 43 + 17 = 41 + 19 = 37 + 23 = 31 + 29.
(End)
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Length@ Select[2n - Prime@ Range@ PrimePi@ n, PrimeQ]; nn = 100; t = Table[0, {nn}]; k = 1; cnt = 0; While[cnt < nn, a = f@k; If[a <= nn && t[[a]] == 0, t[[a]] = 2 k; cnt++]; k++]; t (* Robert G. Wilson v, Mar 15 2011 *)

A000954 Conjecturally largest even integer which is an unordered sum of two primes in exactly n ways.

Original entry on oeis.org

2, 12, 68, 128, 152, 188, 332, 398, 368, 488, 632, 692, 626, 992, 878, 908, 1112, 998, 1412, 1202, 1448, 1718, 1532, 1604, 1682, 2048, 2252, 2078, 2672, 2642, 2456, 2936, 2504, 2588, 2978, 3092, 3032, 3218, 3272, 3296, 3632, 3548, 3754, 4022, 4058, 4412
Offset: 0

Views

Author

Keywords

Comments

The Goldbach conjecture is that every even number is the sum of two primes.

Examples

			2 is largest even integer which is the sum of two primes in 0 ways, 12 is largest even integer which is the unordered sum of two primes in 1 way (5+7), etc.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{c = 0, k = 3}, While[k <= n/2, If[PrimeQ[k] && PrimeQ[n - k], c++ ]; k++ ]; c]; a = Table[0, {50}]; a[[1]] = 2; a[[2]] = 4; Do[m = n; b = f[n]; If[b < 100, a[[b + 1]] = n], {n, 6, 20000, 2}] (* Robert G. Wilson v, Dec 20 2003 *)

A025018 Numbers k such that least prime in the Goldbach partition of k increases.

Original entry on oeis.org

4, 6, 12, 30, 98, 220, 308, 556, 992, 2642, 5372, 7426, 43532, 54244, 63274, 113672, 128168, 194428, 194470, 413572, 503222, 1077422, 3526958, 3807404, 10759922, 24106882, 27789878, 37998938, 60119912, 113632822, 187852862, 335070838
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    p = 1; r = {}; Do[ k = 2; While[ !PrimeQ[k] || !PrimeQ[2n - k], k++ ]; If[k > p, p = k; r = Append[r, 2n]], {n, 2, 10^8}]; r
  • PARI
    Gold(n)=forprime(p=2,min(n\2,default(primelimit)),if(isprime(n-p),return(p)))
    r=0;forstep(n=4,1e6,2,t=Gold(n);if(t>r,r=t;print1(n", "))) \\ Charles R Greathouse IV, Feb 21 2012

Extensions

Edited and extended by Robert G. Wilson v, Dec 13 2002

A103152 Smallest odd number which can be written as a sum 2p+q (where p and q are both odd primes, A065091) in exactly n ways, zero if there are no such odd number.

Original entry on oeis.org

9, 13, 17, 29, 45, 51, 69, 81, 99, 93, 105, 135, 153, 201, 195, 165, 231, 237, 321, 297, 225, 363, 725, 393, 285, 315, 471, 483, 435, 405, 465, 561, 555, 495, 609, 783, 675, 867, 849, 963, 645, 525, 693, 897, 795, 915, 987, 735, 855, 825, 765, 1095, 975, 1467
Offset: 1

Views

Author

Lei Zhou, Feb 09 2005

Keywords

Comments

Conjecture: except for the 2nd, 3rd and 4th terms, all other terms are divisible by 3; See also comments in A103151.
a(23)=725 is also not divisible by 3. [D. S. McNeil, Sep 06 2010]
The only terms a(n) not divisible by 3 for n <= 1450 are a(2),a(3),a(4) and a(23). - Robert Israel, Mar 17 2020

Examples

			9 is the smallest odd number with just one such composition: 9 = 3+2*3, thus a(1)=9.
Similarly, 13 is smallest with exactly 2 compositions: 13 = 3+2*5 = 7+2*3, thus a(2)=13.
		

Crossrefs

Programs

  • Maple
    N:= 2000: # for terms before the first term > N
    P:= select(isprime, [seq(i,i=3..N,2)]):
    nP:= nops(P):
    V:= Vector(N):
    for i from 1 while 2*P[i] N then break fi;
        V[k]:= V[k]+1;
    od od:
    A:= Vector(N):
    for i from 1 to N by 2 do if V[i] <> 0 and A[V[i]] = 0 then A[V[i]]:= i fi od:
    for i from 1 to N do if A[i] = 0 then break fi od:
    seq(A[j],j=1..i-1); # Robert Israel, Mar 17 2020
  • Mathematica
    Array[a, 300]; Do[a[n] = 0, {n, 1, 300}]; n = 9; ct = 0; While[ct < 200, m = 3; ct = 0; While[(m*2) < n, If[PrimeQ[m], cp = n - (2* m); If[PrimeQ[cp], ct = ct + 1]]; m = m + 2]; If[a[ct] == 0, a[ct] = n]; n = n + 2]; Print[a]
  • Scheme
    (define (A103152 n) (+ 1 (* 2 (first-n-where-fun_n-is-i1 A103151 n))))
    (define (first-n-where-fun_n-is-i1 fun i) (let loop ((n 1)) (cond ((= i (fun n)) n) (else (loop (+ n 1)))))) ;; Antti Karttunen, Jun 19 2007

Extensions

Starting offset changed from 0 to 1 by Antti Karttunen, Jun 19 2007

A000974 Conjecturally the number of even integers the sum of two primes in exactly n ways.

Original entry on oeis.org

1, 4, 9, 11, 11, 16, 16, 18, 20, 23, 16, 29, 16, 25, 27, 23, 22, 25, 35, 29, 26, 25, 27, 27, 27, 33, 28, 44, 35, 21, 29, 35, 38, 33, 39, 37, 34, 35, 31, 31, 28, 41, 37, 32, 44, 35, 37, 41, 44, 33, 37, 32, 47, 39, 43, 47, 33, 37, 48, 41, 37, 48, 34, 35, 47, 36, 29, 36, 46, 44, 43, 38, 48
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Length[ Select[2n - Prime[ Range[ PrimePi[n]]], PrimeQ]]; a = Table[0, {75}]; Do[c = f[n]; If[c < 75, a[[c + 1]]++ ], {n, 5000}]; a (* Robert G. Wilson v, using Paul Abbott's coding in A002375, Apr 07 2005 *)

A082917 Numbers that can be expressed as the sum of two odd primes in more ways than any smaller even number.

Original entry on oeis.org

6, 10, 22, 34, 48, 60, 78, 84, 90, 114, 120, 168, 180, 210, 300, 330, 390, 420, 510, 630, 780, 840, 990, 1050, 1140, 1260, 1470, 1650, 1680, 1890, 2100, 2310, 2730, 3150, 3570, 3990, 4200, 4410, 4620, 5250, 5460, 6090, 6510, 6930, 7980, 8190, 9030, 9240
Offset: 1

Views

Author

Hugo Pfoertner, Apr 15 2003

Keywords

Comments

The terms up to 114 are identical with A001172. The record-setting number of decompositions is given by A082918.
It appears that every primorial number (A002110) greater than 30 is in this sequence. Sequence A116979 gives the number of decompositions for n equal to a primorial number. - T. D. Noe, Mar 15 2010

Examples

			a(1) = 6 = 3 + 3.
a(2) = 10 because 10 is the smallest number that can be written in two ways: 10 = 3 + 7 = 5 + 5.
		

Crossrefs

Cf. A002375, A001172, A082918. A109679 is another version of the same sequence.

Programs

  • Mathematica
    kmax = 40000;
    ip[k_] := IntegerPartitions[k, {2}, Select[Range[3, k-1], PrimeQ]];
    seq = Module[{k, lg, record = 0, n = 0}, Reap[For[k = 6, k <= kmax, k = k+2, lg = Length[ip[k]]; If[lg > record, record = lg; n = n+1; Print["a(", n, ") = ", k]; Sow[k]]]][[2, 1]]] (* Jean-François Alcover, Jun 04 2022 *)

A105093 Numbers n such that n = prime(k) + prime(k+3) = prime(k+1) + prime(k+2) for some k.

Original entry on oeis.org

18, 24, 30, 36, 60, 84, 120, 162, 204, 210, 216, 240, 288, 330, 372, 390, 456, 520, 540, 624, 726, 762, 798, 840, 852, 882, 924, 978, 990, 1104, 1140, 1164, 1200, 1392, 1410, 1428, 1530, 1632, 1650, 1716, 1740, 1764, 1794, 1848, 1974, 2052, 2100, 2112, 2184
Offset: 1

Views

Author

Giovanni Teofilatto, Apr 06 2005

Keywords

Examples

			a(1)=18 because prime(3)+prime(6)=prime(4)+prime(5)=5+13=7+11=18.
		

Crossrefs

Cf. A001172, A000954, first primes in A022885.

Programs

  • Mathematica
    lst = {}; Do[ If[ Prime[n] + Prime[n + 3] == Prime[n + 1] + Prime[n + 2], AppendTo[lst, Prime[n] + Prime[n + 3]]], {n, 184}]; lst (* Robert G. Wilson v, Apr 07 2005 *)
  • Python
    from sympy import nextprime
    A105093_list, plist = [], [2,3,5,7]
    while len(A105093_list) < 10000:
        m = plist[0]+plist[3]
        if m == plist[1]+plist[2]:
            A105093_list.append(m)
        plist = plist[1:] + [nextprime(plist[-1])] # Chai Wah Wu, Mar 30 2020

Extensions

Edited and extended by Robert G. Wilson v, Apr 07 2005

A280867 Least k such that k is the sum of two totient numbers (A002202) in exactly n ways, or 0 if no such k exists.

Original entry on oeis.org

2, 8, 12, 20, 24, 32, 40, 50, 48, 62, 60, 64, 76, 102, 88, 108, 120, 128, 112, 136, 152, 148, 186, 168, 180, 192, 184, 216, 252, 236, 208, 220, 244, 232, 308, 268, 280, 292, 336, 304, 368, 328, 384, 364, 352, 408, 440, 376, 432, 400, 436, 388, 448, 492, 460, 484, 472, 548
Offset: 1

Views

Author

Altug Alkan, Jan 28 2017

Keywords

Comments

Least k such that A281687(k/2) = n, or 0 if no such k exists.
See also graph of A001172 for similar points.

Examples

			a(4) = 20 because 20 = 2 + 18 = 4 + 16 = 8 + 12 = 10 + 10; 2, 4, 8, 10, 12, 16, 18 are in A002202 and 20 is the least number with this property.
		

Crossrefs

Programs

  • PARI
    a281687(n) = sum(k=1, n, istotient(k) && istotient(2*n-k));
    a(n) = my(k=1); while(a281687(k) != n, k++); 2*k;
    
  • PARI
    do(n)=my(u=select(istotient, [1..n]),v=vector(n),t); for(i=1,#u, for(j=i,#u, t=u[i]+u[j]; if(t>n, break); v[t]++)); t=vector(vecmax(v)); for(i=1,#v, if(v[i] && t[v[i]]==0, t[v[i]]=i)); for(i=1,#t, if(t[i]==0, return(t[1..i-1]))); t \\ Charles R Greathouse IV, Jan 29 2017
Showing 1-10 of 16 results. Next