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

A290496 First differences of A001751.

Original entry on oeis.org

1, 1, 1, 1, 1, 3, 1, 2, 1, 3, 2, 3, 1, 3, 3, 2, 3, 3, 1, 3, 2, 3, 1, 6, 5, 1, 2, 1, 5, 4, 2, 1, 5, 3, 1, 3, 3, 5, 3, 4, 2, 3, 1, 2, 4, 5, 4, 5, 4, 3, 3, 2, 3, 4, 3, 2, 6, 1, 5, 3, 1, 6, 5, 1, 2, 10, 2, 1, 3, 2, 3, 4, 5, 3, 4, 5, 3, 1, 2, 4, 6, 2, 10, 3, 3, 5, 1
Offset: 1

Views

Author

Michel Marcus, Aug 04 2017

Keywords

Crossrefs

Programs

  • Mathematica
    With[{nn = 56}, Differences@ Union@ Flatten@ {#, 2 TakeWhile[#, # < Prime[nn]/2 &]} &@ Prime@ Range@ nn]
  • PARI
    lista(nn) = {last = 2; for (n=3, nn, if (isprime(n) || (!(n%2) && isprime(n/2)), print1(n - last, ", "); last = n;););}

A290572 Least number that is the start of a gap of size n between numbers that are either prime or twice a prime (A001751).

Original entry on oeis.org

2, 11, 7, 67, 53, 47, 514, 401, 317, 181, 467, 526, 1069, 2819, 1262, 3142, 1382, 1913, 1327, 4178, 2477, 9697, 8123, 8329, 3274, 11213, 21031, 5119, 16382, 13063, 20446, 44417, 22193, 37747, 12854, 46957, 35617, 63863, 48679, 20809, 76166, 39251, 110359, 59282, 136898, 212923, 143006
Offset: 1

Views

Author

Bobby Jacobs and Robert G. Wilson v, Aug 06 2017

Keywords

Comments

Numbers that are less than any later number are recorded in A290488.

Examples

			a(1) is  2 since  3 -  2 = 1;
a(2) is 11 since 13 - 11 = 2;
a(3) is  7 since 10 -  7 = 3;
a(4) is 67 since 71 - 67 = 4; etc.
		

Crossrefs

Programs

  • Mathematica
    nxt[n_] := Block[{k = n +1}, While[ !PrimeQ[k] && !PrimeQ[k/2], k++]; k]; p = 2; q = 3; t[_] = 0; While[p < 215000, d = q - p; If[ t[d] == 0, t[d] = p]; p = q; q = nxt@ q]; t@# & /@ Range@ 47

A046022 Primes together with 1 and 4.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269
Offset: 1

Views

Author

Keywords

Comments

Also the numbers which are incrementally largest values of A002034. - validated by Franklin T. Adams-Watters, Jul 13 2012
Solutions to A000005(x) + A000010(x) - x - 1 = 0. - Labos Elemer, Aug 23 2001
Also numbers m such that m, phi(m) and tau(m) form an integer triangle, where phi=A000010 is the totient and tau=A000005 the number of divisors (see also A084820). - Reinhard Zumkeller, Jun 04 2003
Terms > 1 are n such that n does not divide (n-1)!. - Benoit Cloitre, Nov 12 2003
Terms > 1 are the sum of their prime factors; 4 (= 2+2) is the only such composite number. - Stuart Orford (sjorford(AT)yahoo.co.uk), Aug 04 2005
From Jonathan Vos Post, Aug 23 2010, Robert G. Wilson v, Aug 25 2010, proof by D. S. McNeil, Aug 29 2010: (Start)
Also the numbers n which divide A001414(n), or equivalently divide A075254(n). Proof:
Theorem: for a multiset of m >= 2 integers a_i, each a_i >= 2, Product_{i=1..m} a_i >= Sum_{i=1..m} a_i, with equality only at (a_1,a_2) = (2,2).
Lemma: For integers x,y >= 2, if x > 2 or y > 2, x*y > x + y. This follows from distributing (x-1)*(y-1) > 1.
[Proof of the theorem by induction on m:
first consider m=2. We have equality at (2,2) and for any product(a_i) > 4 there is some a_i > 2, so the lemma gives a_1*a_2 > a_1+a_2.
Then the induction m->m+1: Product_{i=1..m+1} a_i = a_(m+1)*Product_{i=1..m} a_i >= a_(m+1) * Sum_{i=1..m} a_i.
Since a_(m+1) >= 2 and the sum >= 4, the lemma applies, and we find a_(m+1) * Sum+{i=1..m} a_i > a_(m+1) + Sum_{i=1..m} a_i = Sum_{i=1..m+1} a_i and thus Product_{i=1..m+1} a_i > Sum_{i=1..m+1} a_i, QED.]
For composite n > 4, applying the theorem to the multiset of prime factors with multiplicity yields n > sopfr(n), so there are no composite numbers greater than 4 such that they divide sopfr(n).
(End)
Numbers k such that the k-th Fibonacci number is relatively prime to all smaller Fibonacci numbers. - Charles R Greathouse IV, Jul 13 2012
Numbers k such that (-1)^k*floor(d(k)*(-1)^k/2) = 1, where d(k) is the number of divisors of k. - Wesley Ivan Hurt, Oct 11 2013
Also, union of odd primes (A065091) and the divisors of 4. Also, union of A008578 and 4. - Omar E. Pol, Nov 04 2013
Numbers k such that sigma(k!) is divisible by sigma((k-1)!). - Altug Alkan, Jul 18 2016

Crossrefs

Programs

  • Haskell
    a046022 n = a046022_list !! (n-1)
    a046022_list = [1..4] ++ drop 2 a000040_list
    -- Reinhard Zumkeller, Apr 06 2014
    
  • Maple
    A046022:=n-> `if`((-1)^n*floor(numtheory[tau](n)*(-1)^n/2) = 1, n, NULL); seq(A046022(j), j=1..260); # Wesley Ivan Hurt, Oct 11 2013
  • Mathematica
    max = 0; a = {}; Do[m = FactorInteger[n]; w = Sum[m[[k]][[1]]*m[[k]][[2]], {k, 1, Length[m]}]; If[w > max, AppendTo[a, w]; max = w], {n, 1, 1000}]; a (* Artur Jasinski, Apr 06 2008 *)
  • PARI
    a(n)=if(n<6,n,prime(n-2)) \\ Charles R Greathouse IV, Apr 28 2015
    
  • Python
    from sympy import prime
    def A046022(n): return prime(n-2) if n>4 else n # Chai Wah Wu, Oct 17 2024

Formula

A141295(a(n)) = a(n). - Reinhard Zumkeller, Jun 23 2008
A018194(a(n)) = 1. - Reinhard Zumkeller, Mar 09 2012
A240471(a(n)) = 1. - Reinhard Zumkeller, Apr 06 2014

Extensions

Better description from Frank Ellermann, Jun 15 2001

A046079 Number of Pythagorean triangles with leg n.

Original entry on oeis.org

0, 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 4, 1, 1, 4, 3, 1, 2, 1, 4, 4, 1, 1, 7, 2, 1, 3, 4, 1, 4, 1, 4, 4, 1, 4, 7, 1, 1, 4, 7, 1, 4, 1, 4, 7, 1, 1, 10, 2, 2, 4, 4, 1, 3, 4, 7, 4, 1, 1, 13, 1, 1, 7, 5, 4, 4, 1, 4, 4, 4, 1, 12, 1, 1, 7, 4, 4, 4, 1, 10, 4, 1, 1, 13, 4, 1, 4, 7, 1, 7, 4, 4, 4, 1, 4, 13, 1, 2, 7
Offset: 1

Views

Author

Keywords

Comments

Number of ways in which n can be the leg (other than the hypotenuse) of a primitive or nonprimitive right triangle.
Number of ways that 2/n can be written as a sum of exactly two distinct unit fractions. For every solution to 2/n = 1/x + 1/y, x < y, the Pythagorean triple is (n, y-x, x+y-n). - T. D. Noe, Sep 11 2002
For n>2, the positions of the ones in this sequence correspond to the prime numbers and their doubles, A001751. - Ant King, Jan 29 2011
Let L = length of longest leg, H = hypotenuse. For odd n: L =(n^2-1)/2 and H = L+1. For even n, L = (n^2-4)/4 and H = L+2. - Richard R. Forberg, May 31 2013
Or number of ways n^2 can be written as the difference of two positive squares: a(3) = 1: 3^2 = 5^2-4^2; a(8) = 2: 8^2 = 10^2-6^2 = 17^2-15^2; a(16) = 3: 16^2 = 20^2-12^2 = 34^2-30^2 = 65^2-63^2. - Alois P. Heinz, Aug 06 2019
Number of ways to write 2n as the sum of two positive integers r and s such that r < s and (s - r) | (s * r). - Wesley Ivan Hurt, Apr 21 2020

References

  • Albert H. Beiler, Recreations in the Theory of Numbers. New York: Dover Publications, 1966, pp. 116-117.

Crossrefs

Programs

  • Mathematica
    a[n_] := (DivisorSigma[0, If[OddQ[n], n, n / 2]^2] - 1) / 2; Table[a[i], {i, 100}] (* Amber Hu (hupo001(AT)gmail.com), Jan 23 2008 *)
    a[ n_] := Length @ FindInstance[ n > 0 && y > 0 && z > 0 && n^2 + y^2 == z^2, {y, z}, Integers, 10^9]; (* Michael Somos, Jul 25 2018 *)
  • PARI
    A046079(n) = ((numdiv(if(n%2, n, n/2)^2)-1)/2); \\ Antti Karttunen, Sep 27 2018
    
  • Python
    from math import prod
    from sympy import factorint
    def A046079(n): return prod((e+(p&1)<<1)-1 for p,e in factorint(n).items())>>1 # Chai Wah Wu, Sep 06 2022
  • Sage
    def A046079(n) : return (number_of_divisors(n^2 if n%2==1 else n^2/4) - 1) // 2 # Eric M. Schmidt, Jan 26 2013
    

Formula

For odd n, a(n) = A018892(n) - 1.
Let n = (2^a0)*(p1^a1)*...*(pk^ak). Then a(n) = [(2*a0 - 1)*(2*a1 + 1)*(2*a2 + 1)*(2*a3 + 1)*...*(2*ak + 1) - 1]/2. Note that if there is no a0 term, i.e., if n is odd, then the first term is simply omitted. - Temple Keller (temple.keller(AT)gmail.com), Jan 05 2008
For odd n, a(n) = (tau(n^2) - 1) / 2; for even n, a(n) = (tau((n / 2)^2) - 1) / 2. - Amber Hu (hupo001(AT)gmail.com), Jan 23 2008
a(n) = Sum_{i=1..n-1} (1 - ceiling(i*(2*n-i)/(2*n-2*i)) + floor(i*(2*n-i)/(2*n-2*i))). - Wesley Ivan Hurt, Apr 21 2020
Sum_{k=1..n} a(k) ~ (n / Pi^2) * (log(n)^2 + c_1 * log(n) + c_2), where c_1 = 2 * (gamma - 1) + 48*log(A) - 4*log(Pi) - 13*log(2)/3 = 3.512088... (gamma = A001620, log(A) = A225746), and c_2 = 6 * gamma^2 - (6 + log(2)) * gamma + 2 - Pi^2/2 + 19*log(2)^2/18 + log(2)/3 - 6*gamma_1 + 8 * (zeta'(2)/zeta(2))^2 + (4 - 12*gamma + 2*log(2)/3) * zeta'(2)/zeta(2) - 4*zeta''(2)/zeta(2) = -4.457877... (gamma_1 = -A082633). - Amiram Eldar, Nov 08 2024

A061743 Numbers k such that k! is divisible by (k+1)^2.

Original entry on oeis.org

11, 14, 15, 17, 19, 20, 23, 24, 26, 27, 29, 31, 32, 34, 35, 38, 39, 41, 43, 44, 47, 48, 49, 50, 51, 53, 54, 55, 56, 59, 62, 63, 64, 65, 67, 68, 69, 71, 74, 75, 76, 77, 79, 80, 83, 84, 86, 87, 89, 90, 91, 92, 94, 95, 97, 98, 99, 101, 103, 104, 107, 109, 110, 111, 113, 114
Offset: 1

Views

Author

Robert G. Wilson v, Jun 21 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[120], IntegerQ[ #!/(# + 1)^2] &]
  • PARI
    { n=0; f=1; for (a=1, 2588, f*=a; if (f%(a + 1)^2 == 0, write("b061743.txt", n++, " ", a)) ) } \\ Harry J. Smith, Jul 27 2009
    
  • PARI
    isok(k) = !(k! % (k+1)^2); \\ Michel Marcus, Jul 01 2018
    
  • Python
    from sympy import primepi
    def A061743(n):
        def f(x): return int(n+2+primepi(x+1)+primepi(x+1>>1))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Oct 17 2024

Formula

a(n) = A264828(n+3)-1. Complement of {A178156} - 1. - Chai Wah Wu, Oct 17 2024

A332672 Number of non-unimodal permutations of a multiset whose multiplicities are the prime indices of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 6, 0, 0, 6, 16, 0, 21, 0, 12, 10, 0, 0, 48, 16, 0, 81, 20, 0, 48, 0, 104, 15, 0, 30, 162, 0, 0, 21, 104, 0, 90, 0, 30, 198, 0, 0, 336, 65, 124, 28, 42, 0, 603, 50, 190, 36, 0, 0, 396, 0, 0, 405, 688, 77, 150, 0, 56, 45, 260, 0
Offset: 1

Views

Author

Gus Wiseman, Feb 23 2020

Keywords

Comments

This multiset is generally not the same as the multiset of prime indices of n. For example, the prime indices of 12 are {1,1,2}, while a multiset whose multiplicities are {1,1,2} is {1,1,2,3}.
A sequence of integers is unimodal if it is the concatenation of a weakly increasing and a weakly decreasing sequence.

Examples

			The a(n) permutations for n = 8, 9, 12, 15, 16:
  213   1212   1213   11212   1324
  312   2112   1312   12112   1423
        2121   2113   12121   2134
               2131   21112   2143
               3112   21121   2314
               3121   21211   2413
                              3124
                              3142
                              3214
                              3241
                              3412
                              4123
                              4132
                              4213
                              4231
                              4312
		

Crossrefs

Positions of zeros are one and A001751.
Support is A264828 without one.
Dominated by A318762.
The complement is counted by A332294.
A less interesting version is A332671.
The opposite version is A332742.
Unimodal compositions are A001523.
Non-unimodal permutations are A059204.
Non-unimodal compositions are A115981.
Non-unimodal normal sequences are A328509.
Heinz numbers of partitions with non-unimodal run-lengths are A332282.
Compositions whose negation is not unimodal are A332669.

Programs

  • Mathematica
    nrmptn[n_]:=Join@@MapIndexed[Table[#2[[1]],{#1}]&,If[n==1,{},Flatten[Cases[FactorInteger[n]//Reverse,{p_,k_}:>Table[PrimePi[p],{k}]]]]];
    unimodQ[q_]:=Or[Length[q]<=1,If[q[[1]]<=q[[2]],unimodQ[Rest[q]],OrderedQ[Reverse[q]]]];
    Table[Length[Select[Permutations[nrmptn[n]],!unimodQ[#]&]],{n,30}]

Formula

a(n) = A332671(A181821(n)).
a(n) + A332294(n) = A318762(n).

A016726 Smallest k such that 1, 4, 9, ..., n^2 are distinct mod k.

Original entry on oeis.org

1, 2, 6, 9, 10, 13, 14, 17, 19, 22, 22, 26, 26, 29, 31, 34, 34, 37, 38, 41, 43, 46, 46, 53, 53, 53, 58, 58, 58, 61, 62, 67, 67, 71, 71, 73, 74, 79, 79, 82, 82, 86, 86, 89, 94, 94, 94, 97, 101, 101, 103, 106, 106, 109, 113, 113, 118, 118, 118, 122, 122, 127, 127, 131, 131, 134
Offset: 1

Views

Author

bernie(AT)wagnerpa.com (Bernie McCabe)

Keywords

Comments

This is the sequence of discriminators of the squares A000290, in the terminology of Arnold et al. - M. F. Hasler, May 04 2016

Crossrefs

Cf. A001751, A192419 (cubes), A192420 (4th powers), A347693.

Programs

  • Haskell
    a016726 n = a016726_list !! (n-1)
    a016726_list = [1,2,6,9] ++ (f 5 $ drop 4 a001751_list) where
       f n qs'@(q:qs) | q < 2*n   = f n qs
                      | otherwise = q : f (n+1) qs'
    -- Reinhard Zumkeller, Jun 20 2011
    
  • Mathematica
    a[n_] := (k = 2n; While[ Not[PrimeQ[k] || PrimeQ[k/2]], k++]; k); a[1]=1; a[2]=2; a[3]=6; a[4]=9; Table[a[n], {n, 1, 66}] (* Jean-François Alcover, Nov 30 2011, after formula *)
    sk[n_]:=Module[{k=2n,n2=Range[n]^2},While[Max[Tally[Mod[n2,k]][[All,2]]]> 1,k++];k]; Join[{1,2},Array[sk,70,3]] (* Harvey P. Dale, Oct 16 2016 *)
  • PARI
    A016726_vec(nMax)={my(S=[], a=1); vector(nMax, n, S=concat(S, n^2); while(#Set(S%a)M. F. Hasler, May 04 2016
    
  • PARI
    A016726(n)=if(n>4,min(nextprime(2*n),2*nextprime(n)),[1,2,6,9][n]) \\ M. F. Hasler, May 04 2016

Formula

For n > 4, a(n) is smallest k >= 2n such that k = p or k = 2p, p a prime.

A290488 Lower ends of record gaps between numbers that are either prime or twice a prime.

Original entry on oeis.org

2, 7, 47, 181, 467, 526, 1069, 1262, 1327, 2477, 3274, 5119, 12854, 20809, 28229, 31397, 338038, 520462, 546391, 1050631, 1761206, 1964987, 3466943, 6084986, 27348829, 27915754, 111108769, 113652443, 230126378, 231902267, 327764081, 438981007, 581755318, 1837981547, 2489382697
Offset: 1

Views

Author

Bobby Jacobs, Aug 03 2017

Keywords

Comments

The gap between 31397 and 31454 is due to the record prime gap between 31397 and 31469 being almost exactly twice the record prime gap between 15683 and 15727.

Examples

			a(3) = 47 because the next number that is a prime or twice a prime after 47 is 53, and that is a record gap of size 6.
		

Crossrefs

Programs

  • Mathematica
    nxt[n_] := Block[{k = n +1}, While[ !PrimeQ[ k] && ! PrimeQ[ k/2], k++]; k]; p = 2; q = 3; mx = 0; lst = {}; While[p < 2500000000, If[q > mx + p, mx = q - p; AppendTo[ lst, p]]; p = q; q = nxt@ q]; lst (* Robert G. Wilson v, Aug 03 2017 *)

Formula

a(n) = A290489(n) - A290541(n).

Extensions

a(11) onward from Robert G. Wilson v, Aug 03 2017

A290489 Upper ends of record gaps between numbers that are either prime or twice a prime.

Original entry on oeis.org

3, 10, 53, 191, 478, 538, 1082, 1277, 1346, 2498, 3299, 5147, 12889, 20849, 28277, 31454, 338098, 520526, 546461, 1050706, 1761289, 1965077, 3467038, 6085103, 27348949, 27915898, 111108917, 113652593, 230126531, 231902434, 327764249, 438981203, 581755523, 1837981759, 2489382911
Offset: 1

Views

Author

Bobby Jacobs, Aug 03 2017

Keywords

Comments

The gap between 31397 and 31454 is due to the record prime gap between 31397 and 31469 being almost exactly twice the record prime gap between 15683 and 15727.

Examples

			a(3) = 53 because the next number that is a prime or twice a prime after 47 is 53, and that is a record gap of size 6.
		

Crossrefs

Programs

  • Mathematica
    p = op = 2; r = 0; Reap[While[p < 10^6, p++; If[PrimeQ[p] || PrimeQ[p/2], g = p - op; If[g > r, Sow@p; r = g]; op = p]]][[2, 1]] (* Giovanni Resta, Aug 04 2017 *)

Formula

a(n) = A290488(n) + A290541(n).

Extensions

a(17)-a(35) from Giovanni Resta, Aug 04 2017

A178156 Numbers m such that (m-1)! is not divisible by m^2.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 17, 19, 22, 23, 26, 29, 31, 34, 37, 38, 41, 43, 46, 47, 53, 58, 59, 61, 62, 67, 71, 73, 74, 79, 82, 83, 86, 89, 94, 97, 101, 103, 106, 107, 109, 113, 118, 122, 127, 131, 134, 137, 139, 142, 146, 149, 151, 157, 158, 163
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 17 2010

Keywords

Comments

Union of {8, 9} and A001751.

References

  • G. Pólya and G. Szegő, Problems and Theorems in Analysis II (Springer 1924, reprinted 1972), Part Eight, Chap. 3, Sect. 1, Problem 133b.

Crossrefs

Programs

  • Haskell
    import Data.List (insert)
    a178156 n = a178156_list !! (n-1)
    a178156_list = insert 9 $ insert 8 a001751_list
    -- Reinhard Zumkeller, Oct 14 2014
    
  • Mathematica
    Select[Range[200],!Divisible[(#-1)!,#^2]&] (* Harvey P. Dale, Mar 06 2016 *)
  • PARI
    for(m=1,3e2,if((m-1)!%m^2,print1(m", "))) \\ Charles R Greathouse IV, Aug 21 2011
    
  • Python
    from sympy import primepi
    def A178156(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return int(n+x-primepi(x)-primepi(x>>1)-(x>=8)-(x>=9))
        return bisection(f,n,n) # Chai Wah Wu, Oct 17 2024

Extensions

Entries corrected by Charles R Greathouse IV, Aug 21 2011
Showing 1-10 of 19 results. Next