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: Ben Paul Thurston

Ben Paul Thurston's wiki page.

Ben Paul Thurston has authored 35 sequences. Here are the ten most recent ones:

A334264 Numbers k > 1 such that (3/2)^k sets a new record for closest fractional part to 1/2.

Original entry on oeis.org

2, 3, 5, 9, 11, 69, 420, 2361, 12432, 21565, 28226, 128389, 274555, 497269, 836000, 1151341, 1973112, 2202332, 2458844, 5402520
Offset: 1

Author

Ben Paul Thurston, Apr 20 2020

Keywords

Crossrefs

A081464 is also related to (3/2) to a power being a record distance from a value of an integer.

Programs

  • Maple
    off := 1; for i from 2 to 1000 do t := (1+1/2)^i-floor((1+1/2)^i); d := abs(1/2-t); if d < off then off := d; print(i) end if end do
  • Mathematica
    dm = 1; r = 3/2; s = {}; Do[r *= 3/2; If[(d = Abs[r - Floor[r] - 1/2]) < dm, dm = d; AppendTo[s, n + 1]], {n, 1, 10^7}]; s (* Amiram Eldar, Jun 08 2020 *)

Extensions

a(8)-a(13) from Amiram Eldar, Jun 08 2020
a(14)-a(16) from Chai Wah Wu, Jul 02 2020
a(17)-a(20) from Bert Dobbelaere, Apr 25 2021

A309815 a(n) is the smallest positive integer x such that sqrt(2) + sqrt(x) is closer to an integer than any other value already in the sequence.

Original entry on oeis.org

1, 2, 3, 6, 7, 13, 21, 112, 243, 275, 466, 761, 1128, 4704, 9523, 10730, 17579, 28085, 41041, 165312, 331299, 372815, 607754, 967441, 1410360, 5648160, 11300259, 12713402, 20707831, 32942845, 48005301, 192060400, 384143763, 432165299, 703818922, 1119543881, 1631318640
Offset: 1

Author

Ben Paul Thurston, Aug 18 2019

Keywords

Comments

If b(n) = round(sqrt(2) + sqrt(a(n))), then (b(n)^2 + 2 - a(n))/(2*b(n)) is an approximation for sqrt(2). Conjecture: all convergents of the continued fraction of sqrt(2) except 1 arise in this way. - Robert Israel, Aug 18 2019

Examples

			a(6) = 13 because sqrt(2)+sqrt(13) is closer to an integer than any of the previous 5 terms.
		

Programs

  • Maple
    R:= 1: delta:= sqrt(2)-1:
    for r from 2 to 10000 do
       x0:= ceil((r - sqrt(2)-delta)^2);
       x1:= floor((r-sqrt(2)+delta)^2);
       for x from x0 to x1 do
         dx:= abs(sqrt(2)+sqrt(x)-r);
         if is(dx < delta) then
           delta:= dx;
           R:= R, x;
         fi
       od
    od:
    R; # Robert Israel, Aug 18 2019
  • Mathematica
    d[x_] := Abs[x - Round[x]]; dm = 1; s = {}; Do[If[(d1 = d[Sqrt[2] + Sqrt[n]]) < dm, dm = d1; AppendTo[s, n]], {n, 1, 10^5}]; s (* Amiram Eldar, Aug 18 2019 *)
  • Python
    import math
    a = 2**(1/2)
    l = []
    closest = 1.0
    for i in range(1, 100000000):
        b = i**(1/2)
        c = abs(a+b - round(a+b))
        if c < closest:
            print(i, c)
            closest = c
            l.append(i)
    print(l)

Extensions

More terms from Giovanni Resta, Aug 19 2019

A317778 Starting with 1,2,3,4,5,6: a(n) is the next smallest number greater than a(n-1) such that a[i] + a[j] + a[k] != a[x] + a[y] + a[z] for 1 <= i,j,k,x,y,z <= n all distinct.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 13, 22, 39, 72, 131, 229, 386, 641, 896, 1164, 1419, 1855, 2831, 3545, 5036, 5750, 8034, 10022, 12227, 14377, 17455, 19951, 24701, 27197, 36455, 42303, 49751, 57232, 65684, 83879, 94391, 110073, 124015, 137442, 156835, 175130, 209215, 229396, 242692
Offset: 1

Author

Ben Paul Thurston, Aug 06 2018

Keywords

Comments

a(n) <= a(n-1) + a(n-2) + a(n-3) - 2. - Charlie Neder, Feb 09 2019

Examples

			After 1,2,3,4,5,6: 7 cannot be the next term because 1+3+7 = 2+4+5.
		

Crossrefs

Cf. A011185.

Programs

  • Python
    def u(series):
        for i in range(0, len(series)):
            for j in range(i+1, len(series)):
                for k in range(j+1, len(series)):
                    for l in range(0, len(series)):
                        for m in range(l+1, len(series)):
                            for n in range(m+1, len(series)):
                                if len(set([i,j,k,l,m,n]))==6:
                                    if series[i]+series[j]+series[k]==series[l]+series[m]+series[n]:
                                        return False
        return True
    def a(series, n):
        a = []
        for i in range(0, len(series)):
            a.append(series[i])
        a.append(n)
        return a
    series = [1, 2, 3,4,5,6]
    for i in range(7, 1000):
        print(i)
        nseries = a(series, i)
        if u(nseries):
            series.append(i)
            print(series)
    print(series)

Extensions

a(24)-a(45) from Charlie Neder, Feb 09 2019

A303610 Circle aliasing numbers with 1/n size steps.

Original entry on oeis.org

10, 1010, 110100, 11010100, 1101100100, 110110100100, 11101010101000, 1110110101001000, 111011010101001000, 11101101101001001000, 1110111010101010001000, 111011101010101010001000, 11110110110101010010010000, 1111011011010101010010010000, 111101110101101010010100010000
Offset: 1

Author

Ben Paul Thurston, May 06 2018

Keywords

Comments

Starting from [-1,0] taking 2*n steps of length 1/n each either up or right, follow the path staying as close to the unit circle as possible. Every step up is considered a 1, every step right is considered a 0.

Examples

			For n=3, we have 110100, meaning if we were to start at [-1, 0] and take 2*n=6 steps of length 1/n = 1/6 which can either be up or to the right, to follow the path of the unit circle the closest we would move up 1, up 1 again, then right, then up again, then right two more times, which we translate to the binary number 110100.
		

Crossrefs

Subsequence of A035928 in binary.

Programs

  • Python
    def closer(pos1, pos2):
        dpos1 = (pos1[0]**2.0+pos1[1]**2.0)**.5
        dpos2 = (pos2[0]**2.0+pos2[1]**2.0)**.5
        if (1.0-dpos1)**2.0 < (1.0-dpos2)**2.0:
            return True
        else:
            return False
    def converts(path):
        return ''.join(path)
    l = []
    for steps in range(1, 20):
        stepsize = 1.0/steps
        pos = [-1.0, 0.0]
        paths = []
        for i in range(0, 2*steps):
            if closer([pos[0]+stepsize, pos[1]], [pos[0], pos[1]+stepsize]):
                pos = [pos[0]+stepsize, pos[1]]
                paths.append(str(0))
            else:
                pos = [pos[0], pos[1]+stepsize]
                paths.append(str(1))
        l.append(int(converts(paths)))
    print(l)

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

Original entry on oeis.org

1, 1, 9, 23, 151, 361, 2409, 5783, 38551, 92521, 616809, 1480343, 9868951, 23685481, 157903209, 378967703, 2526451351, 6063483241, 40423221609, 97015731863, 646771545751, 1552251709801, 10348344732009, 24836027356823, 165573515712151, 397376437709161
Offset: 1

Author

Ben Paul Thurston, Dec 25 2015

Keywords

Examples

			a(4) = 2^(2*3 - 1) + (-1)^3 * 9 = 23.
		

Programs

  • Maple
    f:= gfun:-rectoproc({a(n) = 15*a(n-2) + 16*a(n-4),a(1)=1,a(2)=1,a(3)=9,a(4)=23},a(n),remember):
    map(f, [$1..50]); # Robert Israel, Dec 25 2017
  • Mathematica
    RecurrenceTable[{a[1]==1,a[n+1]==2^(2n-1)+(-1)^n a[n]},a,{n,30}] (* Harvey P. Dale, Dec 20 2017 *)
    f[n_]:= ((7 +7I)(-I)^n + (7 -7I)*I^n +(-1)^(1 +n) 2^(2n) +2^(2 +2n))/34; Array[f, 26] (* or *)
    CoefficientList[ Series[ -(8x^3 -6x^2 +x +1)/(16x^4 +15x^2 -1), {x, 0, 25}], x] (* or *)
    LinearRecurrence[{0, 15, 0, 16}, {1, 1, 9, 23}, 26] (* Robert G. Wilson v, Dec 24 2017 *)
  • PARI
    a=vector(10^3); a[1]=1; for(n=2, #a, a[n] = 2^(2*n-3)-(-1)^n*a[n-1]); a \\ Altug Alkan, Dec 20 2017
    
  • PARI
    first(n) = Vec(x*(1 + x - 6*x^2 + 8*x^3)/((1 - 4*x)*(1 + 4*x)*(1 + x^2)) + O(x^(n+1))) \\ Iain Fox, Dec 21 2017

Formula

From Colin Barker, Dec 21 2017: (Start)
G.f.: x*(1 + x - 6*x^2 + 8*x^3) / ((1 - 4*x)*(1 + 4*x)*(1 + x^2)). [Proved by Iain Fox, Dec 21 2017]
a(n) = ((7+7*i)*(-i)^n + (7-7*i)*i^n + (-1)^(1+n)*4^n + 4^(1+n)) / 34 where i=sqrt(-1).
a(n) = 15*a(n-2) + 16*a(n-4) for n > 4. [Proved by Iain Fox, Dec 21 2017] (End)

Extensions

Corrected by Harvey P. Dale, Dec 20 2017

A265500 Balance scale sequence.

Original entry on oeis.org

1, 2, 7, 21, 52, 167, 501, 1503, 4509, 13527, 40581
Offset: 1

Author

Ben Paul Thurston, Dec 09 2015

Keywords

Comments

Every natural number up to sum(a[1], a[i]) can be written as adding or subtracting unique entries up to a(i).

Examples

			17 = 21-7+1+2, 18=21-1-2, 19=17+2.
		

Formula

a(i+1)= 1+2*sum(a[1], a[i]) (proved).

A265945 n-th derivative of x^(2*x) at x=1.

Original entry on oeis.org

1, 2, 6, 18, 64, 220, 888, 3192, 15104, 48096, 338400, 285120, 13728768, -75484032, 1327431168, -15621137280, 232048220160, -3468200017920, 56208508250112, -959557688285184, 17344153658234880, -330228975428997120, 6611419866845122560, -138844103855232061440
Offset: 0

Author

Ben Paul Thurston, Dec 23 2015

Keywords

Crossrefs

Cf. A005727.

Programs

  • Maple
    S:= series((x+1)^(2*x+2), x, 51):
    seq(coeff(S,x,j)*j!, j=0..50); # Robert Israel, Dec 23 2015
  • Mathematica
    With[{nn=30},CoefficientList[Series[(x+1)^(2x+2),{x,0,nn}],x] Range[0,nn]!] (* Harvey P. Dale, May 20 2018 *)

Formula

E.g.f.: (x+1)^(2*x+2).
From Robert Israel, Dec 23 2015: (Start)
a(n) = Sum_{k=0..n} binomial(n,j)*A005727(j)*A005727(n-j).
a(n+1) = 2*(a(n) + Sum_{k=0..n-1} (-1)^(n-1-k)*n!*a(k)/((n-k)*k!)). (End)

Extensions

More terms from Alois P. Heinz, Dec 23 2015

A235915 a(1) = 1, a(n) = a(n-1) + (digsum(a(n-1)) mod 5) + 1, digsum = A007953.

Original entry on oeis.org

1, 3, 7, 10, 12, 16, 19, 20, 23, 24, 26, 30, 34, 37, 38, 40, 45, 50, 51, 53, 57, 60, 62, 66, 69, 70, 73, 74, 76, 80, 84, 87, 88, 90, 95, 100, 102, 106, 109, 110, 113, 114, 116, 120, 124, 127, 128, 130, 135, 140, 141
Offset: 1

Author

Ben Paul Thurston, Jan 16 2014

Keywords

Examples

			For n = 7, a(6) is 16, where the sum of the digits is 7, of which the remainder when divided by 5 is 2, then plus 1 is 3. Thus a(7) is a(6) + 3 or 19.
		

Crossrefs

Cf. A007953.

Programs

  • Maple
    a:= proc(n) a(n):= `if`(n=1, 1, a(n-1) +1 +irem(
                add(i, i=convert(a(n-1), base, 10)), 5)) end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 15 2014
  • Mathematica
    NestList[#+Mod[Total[IntegerDigits[#]],5]+1&,1,50] (* Harvey P. Dale, Nov 23 2023 *)
  • PARI
    digsum(n)=d=eval(Vec(Str(n))); sum(i=1, #d, d[i])
    a=vector(1000); a[1]=1; for(n=2, #a, a[n]=a[n-1]+digsum(a[n-1])%5+1); a \\ Colin Barker, Feb 14 2014
  • Python
    def adddigits(i):
      s = str(i)
      t=0
      for j in s:
        t = t+int(j)
      return t
    n = 1
    a = [1]
    for i in range(0, 100):
      r = adddigits(n)%5+1
      n = n+r
      a.append(n)
    print(a)
    

A179332 a(1)=1; for each n > 1, a(n) is the smallest number such that Sum_{i=1..n} 1/a(i)^2 < sqrt(2).

Original entry on oeis.org

1, 2, 3, 5, 9, 37, 195, 8584, 1281621, 1325419784, 40182098746967, 203448501599750774078, 4275655952199444141114482835180, 10920781877316031992615629928696178128586477545
Offset: 1

Author

Ben Paul Thurston, Jul 10 2010

Keywords

Comments

In other words, the sequence is the lexicographically first infinite sequence of positive integers whose squared reciprocals sum to less than sqrt(2). After a(1)=1, each term is the smallest number that will not cause the sum of the squares of the reciprocals to exceed the square root of 2.

Examples

			a(1)=1; 1/1^2 = 1;
a(2)=2; 1 + 1/2^2 = 5/4 = 1.25;
a(3)=3; 5/4 + 1/3^2 = 49/36 = 1.3611111111...;
a(4)=5; 49/36 + 1/5^2 = 1261/900 = 1.4011111111...;
a(5)=9; 1261/900 + 1/9^2 = 11449/8100 = 1.4134567901...;
(sums approach sqrt(2) = 1.4142135623...).
		

Crossrefs

Cf. A216245.

Programs

  • Maple
    Digits := 200 : A179332 := proc(n) option remember; if n = 1 then 1; else sqrt(2)-add( 1/procname(i)^2,i=1..n-1) ; ceil( 1/sqrt(%)) ; end if; end proc: seq(A179332(n),n=1..14) ; # R. J. Mathar, Jul 11 2010

Formula

a(n+1) = ceiling(1/sqrt(sqrt(2) - Sum_{i=1..n} 1/a(i)^2)). - R. J. Mathar, Jul 11 2010

Extensions

More terms from R. J. Mathar, Jul 11 2010
Name changed, comments expanded, and example corrected and expanded by Jon E. Schoenfield, Feb 28 2014

A160785 Even squarefree numbers plus 1.

Original entry on oeis.org

3, 7, 11, 15, 23, 27, 31, 35, 39, 43, 47, 59, 63, 67, 71, 75, 79, 83, 87, 95, 103, 107, 111, 115, 119, 123, 131, 135, 139, 143, 147, 155, 159, 167, 171, 175, 179, 183, 187, 191, 195, 203, 207, 211, 215, 219, 223, 227, 231, 239, 247, 255, 259, 263, 267, 275, 279
Offset: 1

Author

Ben Paul Thurston, May 26 2009

Keywords

Examples

			10 is an even squarefree number, so 11 is in this list.
		

Crossrefs

Cf. A005117.

Programs

  • Maple
    with(numtheory): a := proc (n) if issqrfree(2*n) = true then 2*n+1 else end if end proc: seq(a(n), n = 1 .. 150); # Emeric Deutsch, Jun 20 2009

Formula

a(n) = A039956(n) + 1.

Extensions

More terms from Emeric Deutsch, Jun 20 2009