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

A074294 Integers 1 to 2*k followed by integers 1 to 2*k + 2 and so on.

Original entry on oeis.org

1, 2, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 2
Offset: 1

Views

Author

Michael Somos, Aug 20 2002

Keywords

Comments

From Cino Hilliard, Sep 13 2004: (Start)
Also the numerator of the fraction in the continued fraction expansion of sqrt(n) for nonsquare n = 2,3,5,6,7... . E.g., for n = 7,
sqrt(7).=.2.+.3................
...............4..+.3..........
.....................4..+.3....
...........................4.....
3 is the 5th entry in the table. sqrt(1) and sqrt(4) are not included because 1 and 4 are squares." (End)
A074294 is the natural fractal sequence of A002061; the corresponding natural interspersion is A194011; see A194029 for definitions. - Clark Kimberling, Aug 17 2011
It appears that this is also a triangle read by rows in which row n lists the first 2*n positive integers, n >= 1 (see example). - Omar E. Pol, May 29 2012

Examples

			From _Omar E. Pol_, May 29 2012: (Start)
Written as a triangle the sequence begins:
1, 2;
1, 2, 3, 4;
1, 2, 3, 4, 5, 6;
1, 2, 3, 4, 5, 6, 7, 8;
1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12;
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14;
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16;
Row n has length 2*n = A005843(n). (End)
		

Crossrefs

Programs

  • Haskell
    import Data.List (inits)
    a074294 n = a074294_list !! (n-1)
    a074294_list = f $ inits [1..] where
       f (xs:_:xss) = xs ++ f xss
    -- Reinhard Zumkeller, Apr 14 2014
    
  • Maple
    seq(seq((j-n^2-n),j=n^2+n+1..(n+1)^2+n+1),n=0..20); # Robert Israel, Jan 05 2015
  • Mathematica
    A074294[n_] := n - 2*Binomial[Floor[1/2 + Sqrt[n]], 2] (* Enrique Pérez Herrero, Apr 14 2010 *)
    Table[Range[2n],{n,10}]//Flatten (* Harvey P. Dale, Oct 20 2018 *)
  • PARI
    {a(n) = n - 2 * binomial( floor( 1/2 + sqrt(n)), 2)}
    
  • PARI
    c(n) = for(x=2,n,if(issquare(x)==0,a=floor(sqrt(x));print1(x-a^2", "))) /* Cino Hilliard, Sep 13 2004 */
    
  • Python
    from math import isqrt
    def A074294(n): return n+(k:=(m:=isqrt(n))+(n>m*(m+1)))*(1-k) # Chai Wah Wu, Jun 06 2025

Formula

a(n) = n - 2*binomial(floor(1/2 + sqrt(n)), 2).
a(n^2 + n) = 2*n.
a(n) = n - 2 - floor(sqrt(n)+3/2)*floor(sqrt(n)-3/2). - Mikael Aaltonen, Jan 02 2015
G.f.: x/(1-x)^2 - (2*x/(1-x))*Sum_{k>=1} k*x^(k^2+k). That sum is related to Jacobi theta functions. - Robert Israel, Jan 05 2015
a(n) = n + A000194(n) - A053187(n). - Robert Israel, Jan 05 2015

A078446 a(1)=a(2)=1; a(n)=a(n-2)/2 if a(n-2) is even, a(n)=a(n-1)+a(n-2) otherwise.

Original entry on oeis.org

1, 1, 2, 3, 1, 4, 5, 2, 7, 1, 8, 9, 4, 13, 2, 15, 1, 16, 17, 8, 25, 4, 29, 2, 31, 1, 32, 33, 16, 49, 8, 57, 4, 61, 2, 63, 1, 64, 65, 32, 97, 16, 113, 8, 121, 4, 125, 2, 127, 1, 128, 129, 64, 193, 32, 225, 16, 241, 8, 249, 4, 253, 2, 255, 1, 256, 257, 128, 385, 64, 449, 32, 481, 16, 497
Offset: 1

Views

Author

Benoit Cloitre, Dec 31 2002

Keywords

Comments

The following sequences all have the same parity: A004737, A006590, A027052, A071028, A071797, A078358, A078446. - Jeremy Gardiner, Mar 16 2003

Programs

  • Maple
    a:= proc(n) option remember;
          if n < 3 then 1
        elif `mod`(procname(n-2), 2) = 0 then procname(n-2)/2
        else procname(n-1) + procname(n-2)
          fi
        end:
    seq(a(n), n=1..80); # G. C. Greubel, Nov 07 2019
  • Mathematica
    a[n_]:= a[n]= If[n<3, 1, If[EvenQ[a[n-2]], a[n-2]/2, a[n-1]+a[n-2]]];
    Table[a[n], {n, 80}] (* G. C. Greubel, Nov 07 2019 *)
    nxt[{a_,b_}]:={b,If[EvenQ[a],a/2,a+b]}; NestList[nxt,{1,1},80][[;;,1]] (* Harvey P. Dale, Jul 18 2025 *)
  • PARI
    a(n) = if(n<3, 1, if(a(n-2)%2==0, a(n-2)/2, a(n-1) + a(n-2) )); \\ G. C. Greubel, Nov 07 2019
    
  • Sage
    @CachedFunction
    def a(n):
        if (n<3): return 1
        elif (a(n-2)%2==0): return a(n-2)/2
        else: return a(n-1) + a(n-2)
    [a(n) for n in (1..80)] # G. C. Greubel, Nov 07 2019

Formula

a(n^2)=2^n-1; a(n^2+1)=1; a(n^2+2)=2^n; a(n^2+3)=2^n+1; a(n^2+4)=2^(n-1); a(n^2+5)=3*2^n+1 ...; inequality : a(n)/2^sqrt(n) <2
Sum(k=1, n^2, a(k)) = 2*(n-2)*2^n + n*(n+1)/2 + 4

A154333 Difference between n^3 and the next smaller square.

Original entry on oeis.org

1, 4, 2, 15, 4, 20, 19, 28, 53, 39, 35, 47, 81, 40, 11, 127, 13, 56, 135, 79, 45, 39, 67, 135, 249, 152, 83, 48, 53, 104, 207, 7, 216, 100, 26, 431, 28, 116, 270, 496, 277, 104, 546, 503, 524, 615, 139, 368, 685, 391, 155, 732, 652, 648, 726, 55, 293, 631, 170, 704, 405
Offset: 1

Views

Author

M. F. Hasler, Jan 07 2009

Keywords

Comments

The sequence A077116(n) = n^3-[sqrt(n^3)]^2 satisfies A077116(n)=0 <=> n^3 is a square <=> n is a square. It differs from the present sequence (which is always positive) only in these indices, where a(k^2)=2k^3-1.

Crossrefs

Cf. A087285 (range of this sequence, excluding the initial term 1).

Programs

  • Maple
    A154333 := proc(n)
        A071797(n^3) ;
    end proc: # R. J. Mathar, May 29 2016
  • Mathematica
    nss[n_]:=Module[{n3=n^3,s},s=Floor[Sqrt[n3]]^2;If[s==n3,s=(Sqrt[s]- 1)^2, s]]; Table[n^3-nss[n],{n,70}] (* Harvey P. Dale, Jan 19 2017 *)
  • PARI
    A154333(n) = n^3-sqrtint(n^3-1)^2
    a154333 = vector(90,n,n^3-sqrtint(n^3-1)^2)

Formula

a(n) = n^3 - [sqrt(n^3 - 1)]^2 = A000578(n) - A048760(n^3-1). a(k^2) = 2 k^3 - 1.
a(n) = A071797(n^3). - R. J. Mathar, May 29 2016

A220693 Irregular triangle where the k-th item in the n-th row (both starting from 1) tells in how many ways we can add 2 distinct integers from 1 to n in such a way that the sum is divisible by k. Row n has 2n-1 terms.

Original entry on oeis.org

0, 1, 0, 1, 3, 1, 1, 1, 1, 6, 2, 2, 1, 2, 1, 1, 10, 4, 4, 2, 2, 2, 2, 1, 1, 15, 6, 5, 3, 3, 2, 3, 2, 2, 1, 1, 21, 9, 7, 5, 4, 3, 3, 3, 3, 2, 2, 1, 1, 28, 12, 10, 6, 6, 4, 4, 3, 4, 3, 3, 2, 2, 1, 1, 36, 16, 12, 8, 8, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 1, 1
Offset: 1

Views

Author

Antti Karttunen, Feb 18 2013. Proposed by Robert Israel, May 07 2012

Keywords

Comments

After the first two rows, this irregular table gives all the nonzero terms from the beginning of each row of A220691. See the comments there and at A061857.

Examples

			Row n (starting from row 1) has 2n-1 terms in this irregular table:
   0;
   1, 0, 1;
   3, 1, 1, 1, 1;
   6, 2, 2, 1, 2, 1, 1;
  10, 4, 4, 2, 2, 2, 2, 1, 1;
  15, 6, 5, 3, 3, 2, 3, 2, 2, 1, 1;
  etc.
See A220691 and A061857 for the meaning of each term.
		

Programs

Formula

See Robert Israel's formula at A061857.

A056007 Difference between 2^n and largest square strictly less than 2^n.

Original entry on oeis.org

1, 1, 3, 4, 7, 7, 15, 7, 31, 28, 63, 23, 127, 92, 255, 7, 511, 28, 1023, 112, 2047, 448, 4095, 1792, 8191, 7168, 16383, 5503, 32767, 22012, 65535, 88048, 131071, 166831, 262143, 296599, 524287, 444943, 1048575, 296863, 2097151, 1187452, 4194303
Offset: 0

Views

Author

Henry Bottomley, Jul 24 2000

Keywords

Comments

Note that this is not a strictly ascending sequence. - Alonso del Arte, Apr 28 2022

Examples

			a(5) = 2^5 - 5^2 =  7;
a(6) = 2^6 - 7^2 = 15.
		

Crossrefs

Programs

  • Mathematica
    Table[2^n - Floor[Sqrt[2^n - Boole[EvenQ[n]]]]^2, {n, 0, 47}] (* Alonso del Arte, Apr 28 2022 *)
  • PARI
    a(n) = if(n%2, sqrtint(1<Kevin Ryde, Oct 12 2022
  • Python
    from math import isqrt
    def a(n): return 2**n - isqrt(2**n-1)**2
    print([a(n) for n in range(43)]) # Michael S. Branicky, Apr 29 2022
    

Formula

a(n) = 2^n - (ceiling(2^(n/2)) - 1)^2 = A000079(n) - (A017912(n) - 1)^2. - Vladeta Jovovic, May 01 2003
a(n) = A071797(A000079(n)). - Michel Marcus, Apr 29 2022
a(n) = 2^n - A357754(n). - Kevin Ryde, Oct 12 2022

A194032 Natural interspersion of the squares (1,4,9,16,25,...), a rectangular array, by antidiagonals.

Original entry on oeis.org

1, 4, 2, 9, 5, 3, 16, 10, 6, 7, 25, 17, 11, 12, 8, 36, 26, 18, 19, 13, 14, 49, 37, 27, 28, 20, 21, 15, 64, 50, 38, 39, 29, 30, 22, 23, 81, 65, 51, 52, 40, 41, 31, 32, 24, 100, 82, 66, 67, 53, 54, 42, 43, 33, 34, 121, 101, 83, 84, 68, 69, 55, 56, 44, 45
Offset: 1

Views

Author

Clark Kimberling, Aug 12 2011

Keywords

Comments

See A194029 for definitions of natural fractal sequence and natural interspersion. Every positive integer occurs exactly once (and every pair of rows intersperse), so that as a sequence, A194032 is a permutation of the positive integers; its inverse is A194033.

Examples

			Northwest corner:
  1...4...9...16...25
  2...5...10..17...26
  3...6...11..18...27
  7...12..19..28...39
  8...13..20..29...40
		

Crossrefs

Programs

  • Mathematica
    z = 30;
    c[k_] := k^2;
    c = Table[c[k], {k, 1, z}]  (* A000290 *)
    f[n_] := If[MemberQ[c, n], 1, 1 + f[n - 1]] (* A071797 *)
    f = Table[f[n], {n, 1, 255}]
    r[n_] := Flatten[Position[f, n]]
    t[n_, k_] := r[n][[k]]
    TableForm[Table[t[n, k], {n, 1, 7}, {k, 1, 7}]]
    p = Flatten[Table[t[k, n - k + 1], {n, 1, 14}, {k, 1, n}]] (* A194032 *)
    q[n_] := Position[p, n]; Flatten[Table[q[n], {n, 1, 70}]] (* A194033 *)

Formula

T(n, k) = (k + max(floor(n/2)-1,0))^2 + n - 1. - Zhuorui He, Jul 08 2025

A194036 Natural interspersion of A028872, a rectangular array, by antidiagonals.

Original entry on oeis.org

1, 6, 2, 13, 7, 3, 22, 14, 8, 4, 33, 23, 15, 9, 5, 46, 34, 24, 16, 10, 11, 61, 47, 35, 25, 17, 18, 12, 78, 62, 48, 36, 26, 27, 19, 20, 97, 79, 63, 49, 37, 38, 28, 29, 21, 118, 98, 80, 64, 50, 51, 39, 40, 30, 31, 141, 119, 99, 81, 65, 66, 52, 53, 41, 42, 32, 166, 142
Offset: 1

Views

Author

Clark Kimberling, Aug 12 2011

Keywords

Comments

See A194029 for definitions of natural fractal sequence and natural interspersion. Every positive integer occurs exactly once (and every pair of rows intersperse), so that as a sequence, A194036 is a permutation of the positive integers; its inverse is A194037.

Examples

			Northwest corner:
1...6...13...22...33
2...7...14...23...34
3...8...15...24...35
4...9...16...25...36
5...10..17...26...37
11..18..27...38...51
		

Crossrefs

Programs

  • Mathematica
    z = 30;
    c[k_] := k^2 + 2 k - 2;
    c = Table[c[k], {k, 1, z}]  (* A028872 *)
    f[n_] := If[MemberQ[c, n], 1, 1 + f[n - 1]]
    f = Table[f[n], {n, 1, 255}]  (* A071797 *)
    r[n_] := Flatten[Position[f, n]]
    t[n_, k_] := r[n][[k]]
    TableForm[Table[t[n, k], {n, 1, 7}, {k, 1, 7}]]
    p = Flatten[Table[t[k, n - k + 1], {n, 1, 13}, {k, 1, n}]]  (* A194036 *)
    q[n_] := Position[p, n]; Flatten[Table[q[n], {n, 1, 70}]]  (* A194037 *)

A227453 Numbers k such that the distance to the largest square less than k is a multiple of 4.

Original entry on oeis.org

8, 13, 20, 24, 29, 33, 40, 44, 48, 53, 57, 61, 68, 72, 76, 80, 85, 89, 93, 97, 104, 108, 112, 116, 120, 125, 129, 133, 137, 141, 148, 152, 156, 160, 164, 168, 173, 177, 181, 185, 189, 193, 200, 204, 208, 212, 216, 220, 224, 229, 233, 237, 241, 245, 249, 253, 260, 264, 268, 272, 276, 280
Offset: 1

Views

Author

Ralf Stephan, Sep 22 2013

Keywords

Comments

A071797(a(n)) = 4*m, A053186(a(n)+1) = 4*m, m > 0.
Apparently a bisection of A079896. While it may not be difficult to prove that the sequence is a subsequence of A079896, the apparent fact that a(n) = A079896(2n-1) is by no means obvious.

Examples

			8 - 2^2 = 1*4 and 24 - 4^2 = 2*4 so 8 and 24 are in the sequence.
		

Crossrefs

Programs

  • Mathematica
    lsm4Q[n_]:=Module[{s=Floor[Sqrt[n]]^2},sHarvey P. Dale, Jun 20 2014 *)
  • PARI
    is(n)=(n-sqrtint(n-1)^2)%4==0

A364602 Triangle T(n,k) with rows of length 2*n-1, generated by T(1,1)=0, T(n,1)=T(n-1,1)+2, T(n,2)=4*(n-1)-1, and for k>=3, T(n,k)=4*T(n-1,k-2)+1.

Original entry on oeis.org

0, 2, 3, 1, 4, 7, 9, 13, 5, 6, 11, 17, 29, 37, 53, 21, 8, 15, 25, 45, 69, 117, 149, 213, 85, 10, 19, 33, 61, 101, 181, 277, 469, 597, 853, 341, 12, 23, 41, 77, 133, 245, 405, 725, 1109, 1877, 2389, 3413, 1365, 14, 27, 49, 93, 165, 309, 533, 981, 1621, 2901
Offset: 1

Views

Author

Ruud H.G. van Tol, Jul 29 2023

Keywords

Comments

The sequence is a permutation of all integers >= 0.
Each row of T contains n*2-1 terms; the terms in column k increase by 2^k.
T(1,1) = 0; T(2,2) = 3.
T(2,1) = T(1,1)+2 = 2; T(2,3) = 4*T(1,1)+1 = 1 ("knight jump").
In the context of the 3x+1 problem, when a term x is used to represent the odd 4*x+1, its successor is 3*x+1, and k-1 is the 2-adic valuation of 3*x+1.
Right diagonal is A002450.
The terms at the top of the columns are A096773(k), or (2^(k-1)*(3 + 2*(-1)^k) - 1)/3.
When the table is analytically continued upwards by subtracting 2^k, the first layer of values are -A255138(k), or -(2^k*(3 + 2*(-1)^k) + 1)/3.

Examples

			Triangle T(n,k) begins:
n/k 1| 2| 3| 4|  5|  6|  7|  8|  9| 10| 11|
1|  0
2|  2  3  1
3|  4  7  9 13   5
4|  6 11 17 29  37  53  21
5|  8 15 25 45  69 117 149 213  85
6| 10 19 33 61 101 181 277 469 597 853 341
7| 12 ...
		

Crossrefs

Programs

  • PARI
    my(N=8, v=Vec([0, 2, 3, 1], N^2), p=4); for(n=3, N, my(K=2*n-1); for(k=1, K, v[p+k]=if(k<=2, v[p-K+k+2]+2^k, 4*v[p-K+k]+1)); p+=K); v
    
  • PARI
    T(n, k) = 2^k*(n-(6*k+3-(-1)^k)/12)-1/3;
    
  • PARI
    n_of_x(x) = my(n=0); while(1==x%4, x>>=2; n++); n + if(x%2,(x+1)/4,  x/2) + 1;
    
  • PARI
    k_of_x(x) = valuation(3*x+1,2) + 1;

Formula

For n>1, T(n,k) = T(n-1,k) + 2^k, so T(n,1) = 2*(n-1).
T(n,2) = 4*(n-1)-1 = 2*T(n,1)-1, so T(2,2) = 3.
For n>1 and k>2, T(n,k) = 4*T(n-1,k-2)+1, so T(2,3) = 1.
For i>=0, a(i^2+1) = T(i+1,1).
T(n, k) = 2^k * (n - (6*k + 3 - (-1)^k)/12) - 1/3.
T(n,1) == 0 (mod 2); T(n,2) == 3 (mod 4); T(n,k>=3) == 1 (mod 4).
k = v2(3*T(n,k)+1) + 1, where v2(x) = A007814(x) is the 2-adic valuation of x.
Previous Showing 11-19 of 19 results.