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.

User: Richard Peterson

Richard Peterson's wiki page.

Richard Peterson has authored 10 sequences.

A377266 Primes p with the property that there exist nonnegative integers m,n such that m!*n! is congruent to either +1 or -1 mod p^2, with m + n = p - 1.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 47, 53, 59, 61, 71, 107, 137, 149, 173, 227, 251, 277, 313, 347, 349, 359, 367, 373, 409, 419, 443, 463, 467, 479, 491, 499, 521, 523, 541, 563, 577, 599, 607, 613, 617, 631, 643, 647, 677, 683, 739, 751, 757, 809, 811, 821, 823, 827, 829
Offset: 1

Author

Richard Peterson, Oct 22 2024

Keywords

Comments

The generalization of Wilson's Theorem that x!*(p-1-x)! is either +1 or -1 mod p when p is prime is known. This is investigated here for cases of p such that there is an x with x!*(p-1-x)! congruent to either +1 or -1 mod p^2.

Examples

			0!*4! + 1 = 5^2 and 4+0 = 5-1, so 5 is in the sequence.
1!*9! - 1 = 11^2*2999 and 1+9 = 10-1, so 11 is in the sequence.
0!*12! + 1 = 13^2*2834329 and 0+12 = 13-1, so 13 is in the sequence.
10!*6! + 1 = 17^2*83*108923 and 10+6=17-1, so 17 is in the sequence.
19!*39!-1 is divisible by 59^2 and 19+39=59-1, so 59 is in the sequence.
		

Crossrefs

A007540 is a subsequence.

Programs

  • Maple
    filter:= proc(p) local m,n,A,v;
      A:= Array(0..p);
      A[0]:= 1:
      for n from 1 to p do A[n]:= n*A[n-1] mod p^2 od:
      for m from 0 to (p-1)/2 do
        v:= A[m] * A[p-1-m] mod p^2;
        if v = 1 or v = p^2-1 then return true fi;
      od;
      false
    end proc:
    select(filter, [seq(ithprime(i),i=1..150)]); # Robert Israel, Dec 30 2024
  • PARI
    isok(p)={if(isprime(p), for(m=0, p\2, my(t=(m!*(p-1-m)!%p^2)); if(t==1||t==p^2-1, return(1)))); 0} \\ Andrew Howroyd, Oct 22 2024

Extensions

a(14) onwards from Andrew Howroyd, Oct 22 2024

A362829 Positions in lexicographic order of odd partitions of sufficiently large numbers.

Original entry on oeis.org

1, 3, 7, 10, 15, 20, 27, 30, 39, 41, 51, 56, 69, 72, 75, 93, 95, 101, 123, 128, 132, 134, 160, 163, 166, 172, 176, 212, 214, 220, 227, 229, 273, 278, 282, 284, 291, 297, 353, 356, 359, 365, 369, 379, 382, 384, 453, 455, 461, 468, 470, 481, 483, 490, 579, 584
Offset: 1

Author

Richard Peterson, Aug 01 2023

Keywords

Comments

a(n) is the position in lexicographic order of the n-th odd partition of a sufficiently large number k. As long as the number k whose partitions we are examining is large enough, a(n) will exist and won't change for different k. The number of partitions of an odd number, for example, 101 for k=13, will always appear in the sequence, since 13 is the 101st partition in lexicographic order.
Equivalently, positions of partitions with all parts odd among all partitions with no parts of size 1, ordered first by sum, then lexicographically (with the parts in nondecreasing order); or positions of partitions with all parts even among all partitions ordered first by the number of parts plus the sum of the parts, then lexicographically. - Pontus von Brömssen, Sep 14 2023

Examples

			a(1)=1 because 1+1+...+1 (k times) is the first partition in lexicographic order of any positive integer k, and it is odd.
a(2)=3 because 1+1+...+1(k-3 times)+3=k is the third partition of k lexicographically and it is odd.
		

Crossrefs

Extensions

More terms from Pontus von Brömssen, Sep 14 2023

A350813 a(n) is the least positive number k such that the product of the first n primes that are congruent to 1 (mod 4) is equal to y^2 - k^2 for some integer y.

Original entry on oeis.org

2, 4, 24, 38, 16, 588, 5782, 5528, 80872, 319296, 3217476, 32301914, 20085008, 166518276, 2049477188, 17443412442, 27905362944, 233647747282, 886295348972, 134684992249108, 98002282636962, 392994156083892, 5283713761100536, 76642755213473624, 923250078609721236
Offset: 1

Author

Richard Peterson, Jan 17 2022

Keywords

Comments

Because y^2-k^2=(y-k)(y+k), a method to make k as small as possible is to try to make y-k and y+k as nearly equal as possible.
Because each of y-k and y+k are made up of primes of form 1 mod 4, algebra shows that k=a(n) is always even.

Examples

			For n=3, m = 5*13*17. The "middle" most nearly equal divisor and codivisor of m are y-k=17 and y+k=65, whence a(n) = (65 - 17)/2 = 24.
		

Crossrefs

Programs

  • Python
    from math import prod, isqrt
    from itertools import islice
    from sympy import sieve, divisors
    def A350813(n):
        m = prod(islice(filter(lambda p: p % 4 == 1, sieve),n))
        a = isqrt(m)
        d = max(filter(lambda d: d <= a, divisors(m,generator=True)))
        return (m//d-d)//2 # Chai Wah Wu, Mar 29 2022

Extensions

Terms corrected by and more terms from Jinyuan Wang, Mar 17 2022

A348635 a(n) is the smallest positive number k coprime to (2n+1)!! such that (2n+1)!! + k^2 is a square.

Original entry on oeis.org

1, 1, 4, 4, 29, 17, 436, 356, 569, 1847, 27704, 72944, 1283333, 726079, 23833532, 45232276, 302068799, 616565857, 26369361188, 23157514888, 70991664061, 505527042479, 1150735735948, 13238389944712, 58668785675111, 209280259070287, 7809609503808088, 530566746979816
Offset: 1

Author

Richard Peterson, Dec 13 2021

Keywords

Comments

a(n) always exists since the set of k coprime to (2n+1)!! and with (2n+1)!! + k^2 equal to a square is nonempty, because k = ((2n+1)!!-1)/2 is in the set.

Examples

			a(5)=29 since 106^2 - 29^2 = 10395 = 3*5*7*9*11 and 29 is relatively prime to 10395 and is as small as possible.
		

Crossrefs

Programs

  • PARI
    df(n) = (2*n)! / n! / 2^n; \\ A001147
    a(n) = my(d=df(n+1), k=1); while (!((gcd(d,k)==1) && issquare(d+k^2)), k++); k; \\ Michel Marcus, Jan 06 2022
    
  • PARI
    df(n) = (2*n)! / n! / 2^n; \\ A001147
    a(n) = my(d=df(n+1), m=sqrtint(d), k); while (!(issquare(m^2-d, &k) && gcd(d,k)==1), m++); k; \\ Michel Marcus, Jan 06 2022

Extensions

a(21)-a(24) and a(28) from Jon E. Schoenfield, Jan 06 2022
a(25)-a(27) from Jinyuan Wang, Jan 07 2022

A349708 a(n) is the smallest positive number k such that (product of the first n odd primes) + k^2 is a square.

Original entry on oeis.org

1, 1, 4, 1, 19, 53, 58, 97, 181, 4244, 2122, 31126, 16451, 297392, 2444006, 622249, 2909047, 216182072, 62801719, 769709491, 32522441312, 37859955467, 129549407177, 286721160343, 101419856449, 107709289064864, 72441253480727, 56099073382147, 5249126879235893
Offset: 1

Author

Richard Peterson, Dec 31 2021

Keywords

Comments

a(n) is half the difference between the middle two divisors of A070826(n + 1). - David A. Corneth, Jan 17 2022

Examples

			a(4)=1 because the product of the first 4 odd primes, 3*5*7*11 = 1155, is 34^2 - 1. a(5)=19 because 15015=3*5*7*11*13=124^2-19^2, and no positive integer less than 19 will work in this situation.
		

Crossrefs

Programs

  • PARI
    a(n) = my(k=1, p=prod(k=2, n+1, prime(k))); while (!issquare(k^2+p), k++); k; \\ Michel Marcus, Jan 10 2022
    
  • Python
    from math import isqrt
    from sympy import primorial, divisors
    def A349708(n):
        m = primorial(n+1)//2
        a = isqrt(m)
        d = max(filter(lambda d: d <= a, divisors(m,generator=True)))
        return (m//d-d)//2 # Chai Wah Wu, Mar 29 2022

Extensions

a(15)-a(26) and corrections to a(9) and a(11) from Jinyuan Wang, Jan 07 2022
a(27)-a(30) from Jon E. Schoenfield, Jan 16 2022

A341678 Irregular triangle read by rows: row n consists of all numbers x such that x^2 + y^2 = A006278(n), with 0 < x < y.

Original entry on oeis.org

1, 1, 4, 4, 9, 12, 23, 2, 19, 46, 67, 74, 86, 109, 122, 64, 103, 167, 191, 236, 281, 292, 359, 449, 512, 568, 601, 607, 664, 673, 743, 59, 132, 531, 581, 627, 876, 1008, 1284, 1588, 1659, 1723, 2092, 2136, 2317, 2373, 2736, 2757, 2803, 3072, 3164, 3333, 3469, 3704, 3821, 4028, 4077, 4136, 4371, 4596, 4668, 4712, 4851
Offset: 1

Author

Richard Peterson, Feb 17 2021

Keywords

Comments

The n-th row of the triangle is of length 2^(n-1), since a product of n distinct primes congruent to 1 (mod 4) has 2^(n-1) solutions to being the sum of two squares.

Examples

			Triangle starts:
1,
1, 4,
4, 9, 12, 23,
2, 19, 46, 67, 74, 86, 109, 122,
64, 103, 167, 191, 236, 281, 292, 359, 449, 512, 568, 601, 607, 664, 673, 743,
...
In the second row, calculations are as follows. 5*13 is the product of the first two primes congruent to 1 (mod 4), and 65 = 1^2 + 8^2 = 4^2 + 7^2, so the second row is 1, 4.
		

Crossrefs

Cf. A236381 (1st column).

Programs

  • PARI
    row(n) = {my(t=1, q=3, v=vector(2^n/2)); for(k=1, n, until(q%4==1, q=nextprime(q+1)); t*=q); q=0; for(k=1, #v, until(issquare(t-q^2), q++); v[k]=q); v; } \\ Jinyuan Wang, Mar 03 2021

A338085 a(n) is the cardinality of S(n), the subset of partitions of n such that there are enough smaller parts to add together to be greater than a larger part.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 5, 5, 12, 18, 30, 36, 65, 83, 120, 159, 225, 284, 395, 495, 665, 848, 1094, 1348, 1757, 2184, 2746, 3399, 4250, 5199, 6469, 7867, 9667, 11756, 14310, 17266, 20988, 25216, 30372, 36371, 43648, 52041, 62187, 73866, 87837, 104105, 123279, 145453
Offset: 1

Author

Richard Peterson, Oct 08 2020

Keywords

Comments

In George Andrews’s partition notation, exponents mean repeated addition, not repeated multiplication. So (p^K)(q^L) with p0 and the parts pk arranged in increasing order, suppose E1p1+E2p2+..Ekpk>p(k+1) for some 1
For any partition in S, the number of parts must be at least 3, with at least 2 distinct parts.
The sequence a(n) is nondecreasing since if a(n-1)=t, then t distinct elements of S(n) can be formed by putting a dot in the lower left corner of the Ferrers diagram for each element of S(n-1).
Closure: Given a partition X in S(x) and partition Y in S(y): The partition X+Y given by concatenation is in S(x+y). So a(x)+a(y) might be provably less than or equal to S(x+y). X and Y can be multiplied to give a partition XY in S(xy). The two operations obey distributivity of multiplication over addition.

Examples

			(4^2)(7^3), a partition of 29, is in S(29) since 2*4=8>7.
Also, (1^3)(3^2)(7^1)(20^4), a partition of 96, is in S(96) since 3*1+2*3=9>7.
But (1^3)(4^5) is not in S(23) because 3*1 is not greater than 4.
		

Programs

  • Mathematica
    ispart[p_] := Module[{s = 0}, For[i = 1, i <= Length[p], i++, If[s > p[[i]] && p[[i]] > p[[i-1]], Return[1]]; s += p[[i]]]; 0];
    a[n_] := a[n] = Module[{c = 0}, Do[ c += ispart[p], {p, Reverse /@ IntegerPartitions[n]}]; c];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, 50}] (* Jean-François Alcover, Nov 13 2020, after Andrew Howroyd *)
  • PARI
    ispart(p)={my(s=0);for(i=1, #p, if(s>p[i]&&p[i]>p[i-1], return(1)); s+=p[i]);0}
    a(n)={my(c=0); forpart(p=n, c+=ispart(p)); c} \\ Andrew Howroyd, Oct 25 2020
    
  • PARI
    a(n)={local(Cache=Map()); my(F(r,k,b)=my(hk=[r,k,b],z); if(!mapisdefined(Cache, hk, &z), z = if(k<=1, b, sum(m=0, r\k, self()(r-m*k, k-1, b||(m&&r-m*k>k)))); mapput(Cache, hk, z)); z); F(n,n,0)} \\ Andrew Howroyd, Nov 03 2020

Extensions

Terms a(15) and beyond from Andrew Howroyd, Nov 03 2020

A337674 Numbers k whose prime divisors are all less than or equal to the number of divisors of k.

Original entry on oeis.org

1, 2, 4, 6, 8, 9, 12, 16, 18, 20, 24, 27, 30, 32, 36, 40, 42, 45, 48, 50, 54, 56, 60, 64, 70, 72, 75, 80, 81, 84, 90, 96, 100, 105, 108, 112, 120, 126, 128, 132, 135, 140, 144, 150, 160, 162, 168, 180, 189, 192, 196, 198, 200, 210, 216, 220, 224, 225, 240, 243, 250
Offset: 1

Author

Richard Peterson, Sep 15 2020

Keywords

Comments

Density: 33 terms between 1 and 100, 17 between 201 and 300, 11 between 1001 and 1100, and 2 between 1000001 and 1000100.

Examples

			42=a(17) is a term, since 2,3 and 7 are the prime divisors of 42, which has 8 divisors. 156=2^2*3*13 is not a term, since 13 is greater than 12, the number of divisors of 156.
		

Crossrefs

A199768 has "strictly less", while this sequence has "less than or equal to".
The union of A199768 and A036878.
A146982 does not include terms 42, 56, 132, 198, 220, 264, 308, 312, 330, ...
Cf. A000005.

Programs

  • Mathematica
    Select[Range[250], FactorInteger[#][[-1, 1]] <= DivisorSigma[0, #] &] (* Amiram Eldar, Sep 22 2020 *)
  • PARI
    isok(m) = #select(x->(x>numdiv(m)), factor(m)[,1]) == 0; \\ Michel Marcus, Sep 22 2020

A333986 Greatest prime factor of A007497(n).

Original entry on oeis.org

2, 3, 2, 7, 2, 5, 3, 5, 7, 5, 7, 5, 127, 7, 8191, 5, 127, 13, 31, 127, 127, 89, 31, 17, 127, 31, 3221, 179, 151, 127, 8191, 13, 262657, 11939, 199, 257, 127, 127, 337, 257, 524287, 73, 1093, 547, 137, 241, 1093, 547, 331, 131071, 1093, 599479, 8191, 137, 127, 8191
Offset: 1

Author

Richard Peterson, Sep 04 2020

Keywords

Crossrefs

Programs

  • Mathematica
    f[1] = 2; f[n_] := f[n] = DivisorSigma[1, f[n - 1]]; Table[FactorInteger[f[n]][[-1, 1]], {n, 50}] (* Amiram Eldar, Sep 23 2020 *)

Formula

a(n) = A006530(A007497(n)). - Michel Marcus, Sep 09 2020

Extensions

More terms from Michel Marcus, Sep 16 2020

A335534 a(n) = tribonacci(n) modulo Fibonacci(n).

Original entry on oeis.org

0, 0, 1, 2, 4, 7, 0, 3, 10, 26, 60, 130, 38, 173, 485, 175, 977, 273, 2789, 2065, 336, 15149, 22718, 39800, 5226, 54214, 2323, 251416, 418400, 93831, 977776, 1518664, 261912, 5208104, 2557037, 3549042, 21177270, 11203146, 36247269, 87596844, 44950918, 261069681
Offset: 1

Author

Richard Peterson, Jun 12 2020

Keywords

Comments

a(n) is congruent to tribonacci(n) modulo k if Fibonacci(n) is divisible by k, although the converse does not hold.

Examples

			For n=10, since tribonacci(10)=81 and Fibonacci(10)=55, a(10)=81 modulo 55 = 26.
		

Crossrefs

Programs

  • Maple
    a:= n-> (<<0|1|0>, <0|0|1>, <1|1|1>>^n)[1, 3] mod (<<0|1>, <1|1>>^n)[1, 2]:
    seq(a(n), n=1..45);  # Alois P. Heinz, Aug 19 2020
  • Mathematica
    m = 42; Mod[LinearRecurrence[{1, 1, 1}, {0, 1, 1}, m], Array[Fibonacci, m]] (* Amiram Eldar, Aug 19 2020 *)
  • PARI
    t(n) = ([0, 1, 0; 0, 0, 1; 1, 1, 1]^n)[1, 3]; \\ A000073
    a(n) = t(n) % fibonacci(n); \\ Michel Marcus, Aug 19 2020