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.

Previous Showing 11-20 of 45 results. Next

A014117 Numbers n such that m^(n+1) == m (mod n) holds for all m.

Original entry on oeis.org

1, 2, 6, 42, 1806
Offset: 1

Views

Author

Keywords

Comments

"Somebody incorrectly remembered Fermat's little theorem as saying that the congruence a^{n+1} = a (mod n) holds for all a if n is prime" (Zagier). The sequence gives the set of integers n for which this property is in fact true.
If i == j (mod n), then m^i == m^j (mod n) for all m. The latter congruence generally holds for any (m, n)=1 with i == j (mod k), k being the order of m modulo n, i.e., the least power k for which m^k == 1 (mod n). - Lekraj Beedassy, Jul 04 2002
Also, numbers n such that n divides denominator of the n-th Bernoulli number B(n) (cf. A106741). Also, numbers n such that 1^n + 2^n + 3^n + ... + n^n == 1 (mod n). Equivalently, numbers n such that B(n)*n == 1 (mod n). Equivalently, Sum_{prime p, (p-1) divides n} n/p == -1 (mod n). It is easy to see that for n > 1, n must be an even squarefree number. Moreover, the set P of prime divisors of all such n satisfies the property: if p is in P, then p-1 is the product of distinct elements of P. This set is P = {2, 3, 7, 43}, implying that the sequence is finite and complete. - Max Alekseyev, Aug 25 2013
In 2005, B. C. Kellner proved E. W. Weisstein's conjecture that denom(B_n) = n only if n = 1806. - Jonathan Sondow, Oct 14 2013
Squarefree numbers n such that b^n == 1 (mod n^2) for every b coprime to n. Squarefree terms of A341858. - Thomas Ordowski, Aug 05 2024
Conjecture: Numbers n such that gcd(d+1, n) > 1 for every proper divisor d of n. Verified up to 10^696. - David Radcliffe, May 29 2025

Crossrefs

Squarefree terms of A124240. - Robert Israel and Thomas Ordowski, Jun 23 2017

Programs

  • Mathematica
    r[n_] := Reduce[ Mod[m^(n+1) - m, n] == 0, m, Integers]; ok[n_] := Range[n]-1 === Simplify[ Mod[ Flatten[ m /. {ToRules[ r[n][[2]] ]}], n], Element[C[1], Integers]]; ok[1] = True; A014117 = {}; Do[ If[ok[n], Print[n]; AppendTo[ A014117, n] ], {n, 1, 2000}] (* Jean-François Alcover, Dec 21 2011 *)
    Select[Range@ 2000, Function[n, Times @@ Boole@ Map[Function[m, PowerMod[m, n + 1, n] == Mod[m, n]], Range@ n] > 0]] (* Michael De Vlieger, Dec 30 2016 *)
  • Python
    [n for n in range(1, 2000) if all(pow(m, n+1, n) == m for m in range(n))] # David Radcliffe, May 29 2025

Formula

For n <= 5, a(n) = a(n-1)^2 + a(n-1) with a(0) = 1. - Raphie Frank, Nov 12 2012
a(n+1) = A007018(n) = A054377(n) = A100016(n) for n = 1, 2, 3, 4. - Jonathan Sondow, Oct 01 2013

A122888 Triangle, read by rows, where row n lists the coefficients of x^k, k=1..2^n, in the n-th iteration of (x + x^2) for n>=0.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 1, 3, 6, 9, 10, 8, 4, 1, 1, 4, 12, 30, 64, 118, 188, 258, 302, 298, 244, 162, 84, 32, 8, 1, 1, 5, 20, 70, 220, 630, 1656, 4014, 8994, 18654, 35832, 63750, 105024, 160120, 225696, 293685, 352074, 387820, 391232, 359992, 300664, 226580
Offset: 0

Views

Author

Paul D. Hanna, Sep 18 2006

Keywords

Comments

T(n, k) is the number of strings of length k-1 on the alphabet {1, 2, ..., n} such that between every two occurrences of a letter i there is an occurrence of a letter strictly larger than i. For example, for n = 3, k = 4 we have the strings 121, 131, 232 and the six permutations of 123. - Joel B. Lewis, May 06 2008

Examples

			Triangle begins:
  1;
  1, 1;
  1, 2, 2, 1;
  1, 3, 6, 9, 10, 8, 4, 1;
  1, 4, 12, 30, 64, 118, 188, 258, 302, 298, 244, 162, 84, 32, 8, 1;
  1, 5, 20, 70, 220, 630, 1656, 4014, 8994, 18654, 35832, 63750,...;
  1, 6, 30, 135, 560, 2170, 7916, 27326, 89582, 279622, 832680,...;
  1, 7, 42, 231, 1190, 5810, 27076, 121023, 520626, 2161158,...;
  1, 8, 56, 364, 2240, 13188, 74760, 409836, 2179556, 11271436,...;
  1, 9, 72, 540, 3864, 26628, 177744, 1153740, 7303164, 45179508,...;
  1, 10, 90, 765, 6240, 49260, 378312, 2836548, 20817588,...; ...
Multiplying the g.f. of column k by (1-x)^k, k>=1, with leading zeros,
 yields the g.f. of row k in the triangle A122890:
  1;
  0, 1;
  0, 0, 2;
  0, 0, 1, 5;
  0, 0, 0, 10, 14;
  0, 0, 0, 8, 70, 42;
  0, 0, 0, 4, 160, 424, 132;
  0, 0, 0, 1, 250, 1978, 2382, 429;
  0, 0, 0, 0, 302, 6276, 19508, 12804, 1430; ...
in which the main diagonal is the Catalan numbers,
 and the row sums form the factorials.
		

Crossrefs

Cf. A007018 (row sums), diagonals: A112317, A112319, A122887; A092123 (largest term in row); A122889 (antidiagonal sums); A122890 (related triangle).

Programs

  • Maple
    b:= proc(n) option remember; `if`(n=0, x,
          expand((x-> x+x^2)(b(n-1))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..degree(p)))(b(n)):
    seq(T(n), n=0..5);  # Alois P. Heinz, Mar 14 2016
  • Mathematica
    f[0][x_] = x; f[n_][x_] := f[n][x] = f[n-1][x+x^2]; row[n_] := CoefficientList[f[n][x], x] // Rest; Table[row[n], {n, 0, 5} ] // Flatten (* Jean-François Alcover, Sep 10 2012 *)
  • Maxima
    T(m,n):=if m=0 and n=1 then 1 else if m=0 and n>1 then 0 else  if m=1 then binomial(1,n-1) else sum(binomial(i,n-i)*T(m-1,i),i,1,n); /* Vladimir Kruchinin, May 19 2012 */
  • PARI
    {T(n,k)=local(F=x+x^2, G=x+x*O(x^k)); if(n<0, 0, for(i=1, n, G=subst(F, x, G)); return(polcoeff(G, k, x)))}
    for(n=0, 6, for(k=1, 2^n, print1(T(n, k), ", ")); print(""))
    

Formula

T(n,k) = [x^k] F_n(x) where F_{n+1}(x) = F_n(x+x^2) for n>=1, with F_0(x)=x.

Extensions

Name changed slightly by Paul D. Hanna, Apr 29 2013

A007019 a(n) = (2n+1)! / 2^n.

Original entry on oeis.org

1, 3, 30, 630, 22680, 1247400, 97297200, 10216206000, 1389404016000, 237588086736000, 49893498214560000, 12623055048283680000, 3786916514485104000000, 1329207696584271504000000, 539658324813214230624000000, 250941121038144617240160000000, 132496911908140357902804480000000
Offset: 0

Views

Author

Keywords

Comments

Denominators of coefficients of the Taylor series of sinh(sqrt(2*x))/(sqrt(2*x)). - J. Zurita (jrzurita(AT)inaoep.mx), Dec 01 2007

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Numerators: A002067, erf(x): A007680.

Programs

  • Magma
    [Factorial(2*n+1)/2^n: n in [0..25]]; // Vincenzo Librandi, May 14 2011
    
  • Maple
    a[1]:=1:for n from 2 to 50 do a[n]:=a[n-1]*(2*n-1)*(n-1) od: seq(a[n], n=1..14); # Zerinvary Lajos, Mar 08 2008
  • Mathematica
    Table[(2n+1)!/2^n,{n,0,20}] (* Harvey P. Dale, May 13 2011 *)
  • PARI
    a(n) = (2*n+1)!/2^n; \\ Altug Alkan, Aug 27 2018

Formula

sin(x)*cosh(x) = Sum_{n>=0} (-1)^floor(n/2)*x^(2n+1)/a(n). - Benoit Cloitre, Feb 02 2002
a(n) = Product_{k=0..n-1} (A000217(n+1) - A000217(k)). - Anton Zakharov, Sep 14 2016
a(n) ~ sqrt(Pi)*2^(n+2)*n^(2*n+3/2)/exp(2*n). - Ilya Gutkovskiy, Sep 14 2016
a(n) = Product_{j=1..n} T(2j) (where T(k) is the k-th triangular number). For example: a(3) = T(2)*T(4)*T(6) (that is, 630 = 3*10*21). - Rigoberto Florez, Aug 26 2018
From Amiram Eldar, Jun 25 2020: (Start)
Sum_{n>=0} 1/a(n) = sinh(sqrt(2))/sqrt(2).
Sum_{n>=0} (-1)^n/a(n) = sin(sqrt(2))/sqrt(2). (End)

A007996 Primes that divide at least one term of Sylvester's sequence s = A000058: s(n+1) = s(n)^2 - s(n) + 1, s(0) = 2.

Original entry on oeis.org

2, 3, 7, 13, 43, 73, 139, 181, 547, 607, 1033, 1171, 1459, 1861, 1987, 2029, 2287, 2437, 4219, 4519, 6469, 7603, 8221, 9829, 12763, 13147, 13291, 13999, 15373, 17881, 17977, 19597, 20161, 20479, 20641, 20857, 20929, 21661, 23689, 23773, 27031
Offset: 1

Views

Author

Bennett Battaile (bennett.battaile(AT)autodesk.com)

Keywords

Comments

Or, let S_1 = [2] and let S_{n+1} = list formed by sorting the union of S_n together with all prime factors of 1 + Product_i S_n(i) into increasing order; sequence is limit as n -> infinity of S_n.
Prime divisors of the terms of Sylvester's sequence A000058. - Max Alekseyev, Jan 03 2004. Also of A007018. - N. J. A. Sloane, Jan 27 2007
Because all terms of the sequence s(n) are coprime, a prime can divide at most one term. Odoni shows that primes p > 3 in this sequence must satisfy p = 1 (mod 6). - T. D. Noe, Sep 25 2010
See A180871(n) for the index of the first term of A000058 (this is one less than the index of the s-sequence) divisible by a(n). - M. F. Hasler, Apr 24 2014

Crossrefs

The missing primes form A096264.
Cf. A180871 (k such that a(n) divides A000058(k)).
Cf. A323605 (smallest prime dividing A000058(n)).

Programs

  • Maple
    n := 1; for p do if isprime(p) then x := 2 mod p; S := {}; while not member(x,S) do if x=0 then a[n] := p; n := n+1; break; fi; S := S union {x}; x := (x^2-x+1) mod p; od; fi; od;
  • Mathematica
    t={}; p=1; While[Length[t]<100, p=NextPrime[p]; s=Mod[2,p]; k=0; modSet={}; While[s>0 && !MemberQ[modSet,s], AppendTo[modSet,s]; k++; s=Mod[s^2-s+1,p]]; If[s==0, AppendTo[t,{p,k}]]]; Transpose[t][[1]] (* T. D. Noe, Sep 25 2010 *)
  • PARI
    is(n)=my(k=Mod(2,n)); for(i=1, n, k=(k-1)*k+1; if(k==0, return(isprime(n)))); n==2 \\ Charles R Greathouse IV, Sep 30 2015

Extensions

More terms from Max Alekseyev, Jan 03 2004
Entry revised by N. J. A. Sloane, Jan 28 2007
Definition corrected (following a remark by Don Reble) by M. F. Hasler, Apr 24 2014

A004168 a(n+1) = a(n)*(a(n)+1).

Original entry on oeis.org

3, 12, 156, 24492, 599882556, 359859081592975692, 129498558604939936868397356895854556, 16769876680757063368089314196389622249367851612542961252860614401811692
Offset: 0

Views

Author

Keywords

Comments

The next term (a(8)) has 141 digits. - Harvey P. Dale, Jul 02 2021

Crossrefs

Programs

  • Magma
    [n eq 1 select 3 else  Self(n-1)*(Self(n-1)+1): n in [1..10]]; // Vincenzo Librandi, Feb 23 2016
  • Maple
    A004168 := proc(n) option remember; if n=0 then 3 else A004168(n-1)*(A004168(n-1)+1); fi; end;
  • Mathematica
    a = {3}; Do[AppendTo[a, a[[n - 1]] (a[[n - 1]] + 1)], {n, 2, 8}]; a (* Michael De Vlieger, Feb 23 2016 *)
    NestList[#(#+1)&,3,7] (* Harvey P. Dale, Jul 02 2021 *)

Formula

a(n) = A082732(n+3) - 1. - Max Alekseyev, Aug 09 2019

Extensions

a(7) from Vincenzo Librandi, Feb 23 2016

A053631 Pythagorean spiral: a(n-1)+1, a(n) and a(n)+1 are the sides of a right triangle (a primitive Pythagorean triangle).

Original entry on oeis.org

2, 4, 12, 84, 3612, 6526884, 21300113901612, 226847426110843688722000884, 25729877366557343481074291996721923093306518970391612, 331013294649039928396936390888878360035026305412754995683702777533071737279144813617823976263475290370884
Offset: 1

Views

Author

Henry Bottomley, Mar 21 2000

Keywords

Comments

To derive a list of Pythagorean triples from this sequence, we note that the difference between the second and the third terms in the Pythagorean triple is 1 and that the last term of the previous triple gives us the first term in the next triple. Therefore the sequence is completely determined by the initial triple.
A053631 gives us a list of Pythagorean triples beginning with (3,4,5), since a(1)=2. Using any initial value h>1, (2h-1,2h^2-2h,2h^2-2h+1) forms a Pythagorean triple; we can use b(1)=2h-1 and the recursive formula b(n)=b(n-1)^2-b(n-1)+1 for n>1, we can create infinitely many of spirals of this type. - Haoqi Chen, Teena Carroll

Examples

			For n=3, a(n-1) = 4, so we want a right triangle with sides 4 + 1 = 5, a(n), and a(n)+1.  Solving (x+1)^2 = x^2 + 5^2 gives x = 12, so a(3) = 12. - _Michael B. Porter_, Jul 19 2016
		

Crossrefs

Apart from the initial term, the sequence is the same as A127690.

Programs

  • Maple
    a[1]:= 2:
    for n from 2 to 10 do a[n]:= a[n-1] + a[n-1]^2/2 od:
    seq(a[i],i=1..10); # Robert Israel, Jul 08 2015
  • Mathematica
    NestList[# + #^2/2 &, 2, 9] (* Robert G. Wilson v, Dec 12 2012 *)
  • Maxima
    a[1]:2$
    a[n]:=a[n-1] + (a[n-1]^2)/2$
    A053631(n):=a[n]$
    makelist(A053631(n),n,1,10); /* Martin Ettl, Nov 08 2012 */
    
  • PARI
    main(size)={v=vector(size); v[1]=2;for(n=2,size,v[n]=v[n-1]+v[n-1]^2/2);return(v)} /* Anders Hellström, Jul 08 2015 */

Formula

a(1)=2; for n >= 2: a(n) = a(n-1) + a(n-1)^2/2 = A046092(a(n-1)/2).
a(n) = A053630(n) - 1. - Robert G. Wilson v, Jul 29 2014
a(n) = 2*A007018(n-1). - Ivan Neretin, Jul 26 2015

Extensions

Corrected and extended by James Sellers, Mar 22 2000
a(1) = 2 added by Zak Seidov, Apr 10 2007

A082588 a(1) = 1, a(n) = Sum_{d | n and d < n} a(d)^2 for n > 1.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 6, 2, 3, 1, 16, 1, 3, 3, 42, 1, 16, 1, 16, 3, 3, 1, 308, 2, 3, 6, 16, 1, 31, 1, 1806, 3, 3, 3, 532, 1, 3, 3, 308, 1, 31, 1, 16, 16, 3, 1, 96936, 2, 16, 3, 16, 1, 308, 3, 308, 3, 3, 1, 1508, 1, 3, 16, 3263442, 3, 31, 1, 16, 3, 31, 1, 378456
Offset: 1

Views

Author

Reinhard Zumkeller, May 13 2003

Keywords

Comments

The positions of records are A029744. - Andrey Zabolotskiy, Jan 30 2017

Examples

			a(12) = a(1)^2 + a(2)^2 + a(3)^2 + a(4)^2 + a(6)^2 = 1^2 + 1^2 + 1^2 + 2^2 + 3^2 = 1 + 1 + 1 + 4 + 9 = 16.
		

Crossrefs

Programs

  • Mathematica
    a[ n_] := If[ n < 2, Boole[n == 1], Sum[ a[d]^2, {d, Drop[Divisors @ n, -1]}]]; (* Michael Somos, May 19 2018 *)
  • PARI
    a(n) = if (n==1, 1, sumdiv(n, d, if (dMichel Marcus, Jan 30 2017
  • Python
    a = [1]
    for n in range(2, 10001):
       a.append(sum(a[d-1]**2 for d in range(1, n) if n%d == 0))
    print(a)
    # Andrey Zabolotskiy, Jan 30 2017
    

Formula

a(p^(n+1)) = A007018(n) if p is a prime. - Michael Somos, May 19 2018

Extensions

Typo in data corrected by Andrey Zabolotskiy, Jan 30 2017

A174864 a(1) = 1, a(n) = square of the sum of previous terms.

Original entry on oeis.org

1, 1, 4, 36, 1764, 3261636, 10650053687364, 113423713055411194304049636, 12864938683278671740537145884937248491231415124195364
Offset: 1

Views

Author

Giovanni Teofilatto, Mar 31 2010

Keywords

Comments

a(n) divides a(n+1) with result a square.
Except for first two terms, partial sum k of a(n) is divisible by 6.
These numbers are divisible by their digital roots, which makes the sequence a subsequence of A064807. - Ivan N. Ianakiev, Oct 09 2013
a(n) is the number of binary trees in which the nodes are labeled by nonnegative integer heights, the left and right children of each node (if present) must have smaller height, and the root has height n-2. For instance, there are four trees with root height 1: the left and right children of the root may or may not be present, and must each be at height 0 if present. - David Eppstein, Oct 25 2018

Crossrefs

Programs

  • Mathematica
    t = {1}; Do[AppendTo[t, Total[t]^2], {n, 9}]; t (* Vladimir Joseph Stephan Orlovsky, Feb 24 2012 *)
    Join[{1},FoldList[(#+Sqrt[#])^2&,1,Range[7]]] (* Ivan N. Ianakiev, May 08 2015 *)
  • PARI
    a=vector(10);a[1]=a[2]=1;for(n=3,#a,a[n]=a[n-1]*(sqrtint(a[n-1])+1)^2);a

Formula

a(n+1) = (a(n) + sqrt(a(n)))^2 = a(n) * (sqrt(a(n)) + 1)^2 for n > 1. - Charles R Greathouse IV, Jun 30 2011
a(n) = A000058(n-1) - A000058(n-2), n>=2. - Ivan N. Ianakiev, Oct 09 2013
a(n+2) + 1 = ( A000058(n+1)^2+1 ) / ( A000058(n)^2+1 ). - Bill Gosper, Hugo Pfoertner, May 09 2021

A231830 a(0) = 1; for n > 0, a(n) = 1 + 4*Product_{i=1..n-1} a(i)^2.

Original entry on oeis.org

1, 5, 101, 1020101, 1061522231810040101, 1196154511175776540960913502483611007728163340227060101
Offset: 0

Views

Author

Michel Marcus, Nov 14 2013

Keywords

Comments

Sequence designed to show that there are an infinity of primes congruent to 1 modulo 4 (A002144). Terms are not necessarily prime. Their smallest prime factors from A002144 are: 5, 101, 1020101, 53, 686743037.
Next term is too large to include.
From Max Alekseyev, Apr 21 2023: (Start)
Similarly to Sylvester's sequence (A000058), it is unknown if all terms are squarefree.
Primes dividing terms of this sequence are listed in A362252. Since terms are pairwise coprime, for each n prime A362252(n) divides exactly one term, whose index is A362253(n). That is, A362252(n) divides a(A362253(n)). (End)

Crossrefs

Programs

  • PARI
    lista(nn) = {a = vector(nn); a[1] = 5; for (n=2, nn, a[n] = 4*prod(i=1, n-1, a[i]^2) + 1;); a;}

Formula

For n > 1, a(n) = (a(n-1) - 1) * a(n-1)^2 + 1. - Max Alekseyev, Mar 25 2023

Extensions

a(0)=1 prepended by Max Alekseyev, Mar 25 2023

A231831 a(0) = 1; for n > 0, a(n) = -1 + 4*Product_{i=0..n-1} a(i)^2.

Original entry on oeis.org

1, 3, 35, 44099, 85762231424099, 630794963141019085083178800095033630804099
Offset: 0

Views

Author

Michel Marcus, Nov 14 2013

Keywords

Comments

Sequence designed to show that there are an infinity of primes congruent to 3 modulo 4 (A002145). Terms are not necessarily prime. Their smallest prime factor from A002145 are: 3, 7, 11, 23, 4111, 2809343.
Next term is too large to include.
Similarly to Sylvester's sequence (A000058), it is unknown if all terms are squarefree (see also MathOverflow link). - Max Alekseyev, Mar 26 2023
Primes dividing terms of this sequence are listed in A362250. Since terms are pairwise coprime, for each n prime A362250(n) divides exactly one term, whose index is A362251(n). That is, A362250(n) divides a(A362251(n)). - Max Alekseyev, Apr 16 2023

Crossrefs

Programs

  • PARI
    lista(nn) = {a = vector(nn); a[1] = 3; for (n=2, nn, a[n] = 4*prod(i=1, n-1, a[i]^2) - 1;); a;}

Formula

For n > 1, a(n) = (a(n-1) + 1) * a(n-1)^2 - 1. - Max Alekseyev, Mar 26 2023

Extensions

a(0) = 1 prepended by Max Alekseyev, Mar 26 2023
Previous Showing 11-20 of 45 results. Next