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 21-30 of 45 results. Next

A003687 a(n+1) = a(n)-a(1)a(2)...a(n-1), if n>0. a(0)=1, a(1)=2.

Original entry on oeis.org

1, 2, 1, -1, -3, -1, -7, -1, -43, -1, -1807, -1, -3263443, -1, -10650056950807, -1, -113423713055421844361000443, -1, -12864938683278671740537145998360961546653259485195807, -1
Offset: 0

Views

Author

Keywords

Comments

a(n) = a(n-1)-a(n-2)^2+a(n-1)*a(n-2), if n>2. - Michael Somos, Mar 19 2004
Consider the mapping f(a/b) = (a - b)/(ab). Taking a = 2 b = 1 to start with and carrying out this mapping repeatedly on each new (reduced) rational number gives the following sequence 2/1,1/2,-1/2,-3/-2,-1/6,... Sequence contains the numerators. - Amarnath Murthy, Mar 24 2003
An infinite coprime sequence defined by recursion. - Michael Somos, Mar 19 2004

Crossrefs

Cf. A081478.
For n>1, a(2n-1) = -1, a(2n) = -A007018(n-1) - 1.

Programs

  • Magma
    I:=[1,2,1]; [n le 3 select I[n] else Self(n-1)-Self(n-2)^2+Self(n-1)*Self(n-2): n in [1..30]]; // Vincenzo Librandi, Dec 17 2015
  • Mathematica
    {1}~Join~NestList[{(#1 - #2), #1 #2} & @@ # &, {2, 1}, 17] [[All, 1]] (* Michael De Vlieger, Sep 04 2016 *)
  • PARI
    a(n)=local(an); if(n<1,(n==0),an=vector(max(2,n)); an[1]=2; an[2]=1; for(k=3,n,an[k]=an[k-1]-an[k-2]^2+an[k-1]*an[k-2]); an[n])
    
  • Sage
    def A003687():
        x, y = 2, 1
        yield y
        while true:
           yield x
           x, y = x - y, x * y
    a = A003687(); print([next(a) for i in range(20)])  # Peter Luschny, Dec 17 2015
    

A001042 a(n) = a(n-1)^2 - a(n-2)^2.

Original entry on oeis.org

1, 2, 3, 5, 16, 231, 53105, 2820087664, 7952894429824835871, 63248529811938901240357985099443351745, 4000376523371723941902615329287219027543200136435757892789536976747706216384
Offset: 0

Views

Author

Keywords

Comments

The next term has 152 digits. - Franklin T. Adams-Watters, Jun 11 2009

References

  • Archimedeans Problems Drive, Eureka, 27 (1964), 6.
  • 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. A064236 (numbers of digits).

Programs

  • Haskell
    a001042 n = a001042_list !! n
    a001042_list = 1 : 2 : zipWith (-) (tail xs) xs
                   where xs = map (^ 2) a001042_list
    -- Reinhard Zumkeller, Dec 16 2013
  • Mathematica
    RecurrenceTable[{a[0]==1,a[1]==2,a[n]==a[n-1]^2-a[n-2]^2},a,{n,0,12}] (* Harvey P. Dale, Jan 11 2013 *)

Formula

a(n) ~ c^(2^n), where c = 1.1853051643868354640833201434870139866230288004895868726506278977814490371... . - Vaclav Kotesovec, Dec 17 2014

Extensions

More terms from James Sellers, Sep 19 2000.

A117805 Start with 3. Square the previous term and subtract it.

Original entry on oeis.org

3, 6, 30, 870, 756030, 571580604870, 326704387862983487112030, 106735757048926752040856495274871386126283608870, 11392521832807516835658052968328096177131218666695418950023483907701862019030266123104859068030
Offset: 0

Views

Author

Jacob Vecht, Apr 29 2006

Keywords

Comments

The next term is too large to include.
a(n) = A005267(n+1)+1. - R. J. Mathar, Apr 22 2007. This is true by induction. - M. F. Hasler, May 04 2007<
For any a(0) > 2, the sequence a(n) = a(n-1) * (a(n-1) - 1) gives a constructive proof that there exists integers with at least n + 1 distinct prime factors, e.g., a(n). As a corollary, this gives a constructive proof of Euclid's theorem stating that there are an infinity of primes. - Daniel Forgues, Mar 03 2017

Examples

			Start with 3; 3^2 - 3 = 6; 6^2 - 6 = 30; etc.
		

Crossrefs

Cf. A007018.

Programs

  • Maple
    f:=proc(n) option remember; if n=0 then RETURN(3); else RETURN(f(n-1)^2-f(n-1)); fi; end;
  • Mathematica
    k=3;lst={k};Do[k=k^2-k;AppendTo[lst,k],{n,9}];lst (* Vladimir Joseph Stephan Orlovsky, Nov 19 2010 *)
    RecurrenceTable[{a[0]==3, a[n]==a[n-1]*(a[n-1] - 1)}, a, {n, 0, 10}] (* Vaclav Kotesovec, Dec 17 2014 *)
    NestList[#^2-#&,3,10] (* Harvey P. Dale, Oct 11 2023 *)

Formula

a(0) = 3, a(n) = (a(n-1))^2 - a(n-1).
a(n) ~ c^(2^n), where c = 2.330283023986140936420341573975137247354077600883596774023675490739568138... . - Vaclav Kotesovec, Dec 17 2014

A182398 a(n) = (Sum_{k=1..2n} k^2n) mod 2n.

Original entry on oeis.org

1, 2, 1, 4, 5, 2, 7, 8, 3, 6, 11, 4, 13, 14, 5, 16, 17, 6, 19, 12, 1, 22, 23, 8, 25, 26, 9, 28, 29, 58, 31, 32, 11, 34, 35, 12, 37, 38, 13, 24, 41, 2, 43, 44, 15, 46, 47, 16, 49, 30, 17, 52, 53, 18, 45, 56, 19, 58, 59, 116, 61, 62, 3, 64, 65, 22, 67, 68, 23
Offset: 1

Views

Author

Michel Lagneau, Apr 27 2012

Keywords

Comments

Sum_{k=1..n} k^n (mod n) = 0 if n odd.
Properties of this sequence:
a(n) = 1 for n = 1, 3, 21, 903, ...
a(n) = n if n not divisible by 3;
a(3*n) = n except for n = 7, 10, 14, 20, 21, 26, 28, 30, 35, ...
a(21*n) = n, except for n = 10, 20, 26, 30, 40, 43, 50, 52, ...
a(903*n) = n, except for n = 10, ....
It appears that a(A007018(n)/2) = 1 and conjecturally a(m*A007018(n)/2) = m for a majority of value m.
No, a(A007018(n)/2) <> 1 for n > 4. (For example, a(A007018(5)/2) = a(1631721) = 1807.) - Jonathan Sondow, Oct 18 2013
0 < a(n) < 10 for n: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 18, 21, 24, 27, 42, 63, 84, 105, 126, 147, 168, 189, 903, 1806, 2709, 3612, 4515, 5418, 6321, 7224, 8127, .... Search limit was 25000. - Robert G. Wilson v, Jun 18 2015

Crossrefs

Programs

  • Maple
    for n from 1 to 100 do: s:=sum('k^(2*n)', 'k'=1..2*n)
    : x:=irem(s,2*n): printf(`%d, `,x):od:
    # second Maple program:
    a:= n-> add(k&^(2*n) mod (2*n), k=1..2*n) mod (2*n):
    seq(a(n), n=1..100);
  • Mathematica
    Table[Mod[Total[PowerMod[Range[2*n], 2*n, 2*n]], 2*n], {n, 100}] (* T. D. Noe, Apr 28 2012 *)

Formula

a(n) = A031971(2n) mod 2n. - Jonathan Sondow, Oct 18 2013

A368190 Number of (undirected) cycles in the n-Dorogovtsev-Goltsev-Mendes graph.

Original entry on oeis.org

0, 1, 11, 249, 74835, 5890739121, 34755832523270764251, 1207969003612007237832573159205646499369, 1459189113687796591938380205390010178829792070192521048490799792728844237848995
Offset: 0

Views

Author

Eric W. Weisstein, Dec 16 2023

Keywords

Comments

Using the indexing convention that DGM(0) = P_2.
For n > 0, DGM(n) contains a unique longest cycle of length 3*2^(n-1).

Crossrefs

Cf. A007018, A368456, A367967 (5-cycles), A367968 (6-cycles).

Programs

  • PARI
    a(n) = {my(t=0,b=1); for(k=1, n, t = 3*t + b^3; b += b^2); t} \\ Andrew Howroyd, Dec 30 2023

Formula

a(n) = 3*a(n-1) + A007018(n-1)^3 for n > 0. - Andrew Howroyd, Dec 30 2023

Extensions

Offset corrected and a(5) from Eric W. Weisstein, Dec 29 2023
Terms a(6) and beyond from Andrew Howroyd, Dec 30 2023

A081478 Consider the mapping f(a/b) = (a - b)/(ab). Taking a = 2 and b = 1 to start with and carrying out this mapping repeatedly on each new (reduced) rational number gives the following sequence 2/1,1/2,-1/2,-3/-2,-1/6,... Sequence contains the denominators.

Original entry on oeis.org

1, 2, 2, -2, 6, -6, 42, -42, 1806, -1806, 3263442, -3263442, 10650056950806, -10650056950806, 113423713055421844361000442, -113423713055421844361000442, 12864938683278671740537145998360961546653259485195806
Offset: 1

Views

Author

Amarnath Murthy, Mar 24 2003

Keywords

Comments

The mapping f(a/b) = (a + b)/(a - b). Taking a = 2 and b = 1 to start with and carrying out this mapping repeatedly on each new (reduced) rational number gives the periodic sequence 2/1,3/1,2/1,3/1,...

Crossrefs

A003687 gives the numerators.
Cf. A007018.

Programs

  • Mathematica
    Last /@ NestList[{(#1 - #2), #1 #2} & @@ # &, {2, 1}, 16] (* Michael De Vlieger, Sep 04 2016 *)
  • Sage
    # Variant with first four terms slightly different. Absolute values.
    def A081478_abs():
        x, y = 1, 2
        yield x
        while True:
           yield x
           x, y = x * y, x//y + 1
    a = A081478_abs(); print([next(a) for i in range(17)])  # Peter Luschny, Dec 17 2015

Formula

a(2n-1) = A007018(n-1), a(2n) = -A007018(n-1) for n >= 2. - Jianing Song, Oct 10 2021

Extensions

More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 06 2003

A100016 a(0) = 1; a(n+1) = a(n) * (next prime larger than a(n)).

Original entry on oeis.org

1, 2, 6, 42, 1806, 3270666, 10697259354222, 114431357691543566765996394, 13094535623129987017538646614449662873664453962869814, 171466863185420237392391564368967506501628543653753176958938044126997508808439363294403869833497610468982
Offset: 0

Views

Author

Parthasarathy Nambi, Nov 18 2004

Keywords

Comments

Terms are very close to A007018(n), with equality for the first 5 terms. Indeed, sequence A007018 is defined like the present sequence, with nextprime(a(n)) replaced by a(n)+1. - M. F. Hasler, May 20 2019

Examples

			If n=1, then the prime immediately greater than n is 2. Hence the next number is n*p = 1*2 = 2.
If n=2, then the next prime is 3, so the next number in the sequence is 2*3=6.
If n=6, then the next prime is 7, so the next number in the sequence is 6*7=42.
		

Crossrefs

Similar to A074839.
Even more similar to A007018.

Programs

  • Mathematica
    a[0] = 1; a[n_] := a[n - 1]*NextPrime[a[n - 1]]; Table[ a[n], {n, 0, 9}] (* Robert G. Wilson v, Nov 23 2004 *)
    NestList[# NextPrime[#]&,1,10] (* Harvey P. Dale, Oct 15 2016 *)
  • PARI
    (nxt_A100016(n)=n*nextprime(n+1)); A100016_vec=vector(10,i,t=if(i>1,nxt_A100016(t),1)) \\ M. F. Hasler, May 20 2019
    
  • Python
    from itertools import islice
    from sympy import nextprime
    def A100016_gen(): # generator of terms
        yield (a:=1)
        while (a:=a*nextprime(a)): yield a
    A100016_list = list(islice(A100016_gen(),10)) # Chai Wah Wu, Mar 19 2024

Extensions

More terms from Robert G. Wilson v, Nov 23 2004

A139145 a(1) = 1, a(2*n) = a(n)^2, a(2*n+1) = a(n)*(a(n)+1).

Original entry on oeis.org

1, 1, 2, 1, 2, 4, 6, 1, 2, 4, 6, 16, 20, 36, 42, 1, 2, 4, 6, 16, 20, 36, 42, 256, 272, 400, 420, 1296, 1332, 1764, 1806, 1, 2, 4, 6, 16, 20, 36, 42, 256, 272, 400, 420, 1296, 1332, 1764, 1806, 65536, 65792, 73984, 74256, 160000, 160400, 176400, 176820, 1679616
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 10 2008

Keywords

Crossrefs

Cf. A007018.

Programs

  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A139145(n): return (m:=A139145(n>>1))*(m+(n&1)) if n>1 else 1 # Chai Wah Wu, Mar 19 2024

Formula

a(2^n - 1) = A007018(n-1).

A343511 a(n) = 1 + Sum_{d|n, d < n} a(d)^2.

Original entry on oeis.org

1, 2, 2, 6, 2, 10, 2, 42, 6, 10, 2, 146, 2, 10, 10, 1806, 2, 146, 2, 146, 10, 10, 2, 23226, 6, 10, 42, 146, 2, 314, 2, 3263442, 10, 10, 10, 42814, 2, 10, 10, 23226, 2, 314, 2, 146, 146, 10, 2, 542731938, 6, 146, 10, 146, 2, 23226, 10, 23226, 10, 10, 2, 141578, 2, 10, 146, 10650056950806, 10
Offset: 1

Views

Author

Ilya Gutkovskiy, Apr 17 2021

Keywords

Comments

a(n) depends only on the prime signature of n (see formulas). - Bernard Schott, Apr 24 2021

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
          1+add(a(d)^2, d=numtheory[divisors](n) minus {n})
        end:
    seq(a(n), n=1..65);  # Alois P. Heinz, Apr 17 2021
  • Mathematica
    a[n_] := a[n] = 1 + Sum[If[d < n, a[d]^2, 0], {d, Divisors[n]}]; Table[a[n], {n, 65}]
  • PARI
    lista(nn) = {my(va = vector(nn)); for (n=1, nn, va[n] = 1 + sumdiv(n, d, if (dMichel Marcus, Apr 18 2021
  • Python
    from functools import lru_cache
    from sympy import divisors
    @lru_cache(maxsize=None)
    def A343511(n): return 1+sum(A343511(d)**2 for d in divisors(n) if d < n) # Chai Wah Wu, Apr 17 2021
    

Formula

G.f.: x / (1 - x) + Sum_{n>=1} a(n)^2 * x^(2*n) / (1 - x^n).
a(p^k) = A007018(k) for p prime.
From Bernard Schott, Apr 24 2021: (Start)
a(A006881(n)) = 10 for signature [1, 1].
a(A054753(n)) = 146 for signature [2, 1].
a(A007304(n)) = 314 for signature [1, 1, 1].
a(A065036(n)) = 23226 for signature [3, 1].
a(A085986(n)) = 42814 for signature [2, 2].
a(A085987(n)) = 141578 for signature [2, 1, 1]. (End)

A361085 Least prime p > prime(n) such that at least one of p * prime(n)# +- 1 is not squarefree, where prime(n)# is the n-th primorial A002110(n).

Original entry on oeis.org

3, 5, 29, 31, 139, 167, 43, 127, 211, 41, 607, 1223, 71, 769, 1549, 947, 269, 1129, 163, 577, 673, 107, 4057, 1979, 433, 3833, 4177, 383, 1723, 409, 2399, 4517, 3803, 3061, 3299, 457, 3779, 971, 5749, 2843, 13709
Offset: 0

Views

Author

M. F. Hasler, Mar 28 2023

Keywords

Comments

It appears that a product P of distinct primes rarely has the property that P +- 1 has a square factor, and this is even more rare when P has all of the first n primes as factor. This sequence is one possible way to quantify this observation. (One could also display the gap between a(n) and prime(n), or consider b(n) the least product of distinct primes > prime(n) that yields a product with the desired property.)
See also Zumkeller's contested comment in A007018 and the discussion in the linked MathOverflow page.

Examples

			a(0) = 3 because for P = (product of the first 0 primes) = 1, p = 3 is the least prime such that p*P + 1 = 4 = 2^2 is a square; for p = 2 neither p*P - 1 = 1 nor p*P + 1 = 3 has a nontrivial square factor.
a(1) = 5 because for P = (product of the first prime) = 2, p = 5 is the least prime such that p*P - 1 = 9 = 3^2 is a square; for p = 3 none of p*P - 1 = 5 nor p*P + 1 = 7 has a nontrivial square factor.
a(2) = 29 because for P = (product of the first two primes) = 6, p = 29 is the least prime such that p*P + 1 = 5^2*7 has a square factor; for all primes 3 < p < 29 both of p*P +- 1 are squarefree.
		

Crossrefs

Cf. A002110 (factorials), A013929 (numbers that are not squarefree), A007018, A228649 (both related).

Programs

  • Mathematica
    Map[(k = 1; While[AllTrue[Prime[k] # + {-1, 1}, SquareFreeQ], k++]; Prime[k]) &, FoldList[Times, 1, Prime@ Range[24] ] ] (* Michael De Vlieger, Mar 28 2023 *)
  • PARI
    A361085(n, P=vecprod(primes(n)))=forprime(p=prime(n)+1,,(issquarefree(p*P-1)&&issquarefree(p*P+1))||return(p))

Extensions

a(30) from Michael S. Branicky, Mar 29 2023
a(31)-a(40) from Jinyuan Wang, Mar 30 2023
Previous Showing 21-30 of 45 results. Next