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 33 results. Next

A099627 Triangle read by rows: T(n,k) = 2^n + 2^k - 1 with n >= k >= 0.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 8, 9, 11, 15, 16, 17, 19, 23, 31, 32, 33, 35, 39, 47, 63, 64, 65, 67, 71, 79, 95, 127, 128, 129, 131, 135, 143, 159, 191, 255, 256, 257, 259, 263, 271, 287, 319, 383, 511, 512, 513, 515, 519, 527, 543, 575, 639, 767, 1023, 1024, 1025, 1027, 1031, 1039
Offset: 0

Views

Author

Henry Bottomley, Oct 25 2004

Keywords

Comments

Positive integers m where m-th Catalan number A000108(m) = C(2m,m)/(m+1) is not divisible by 4, i.e. where A048881(m) is 0 or 1.
Numbers in A000225 or A099628.
From Charles L. Hohn, Jul 25 2024: (Start)
Integers >=1 whose binary digit counts (number of 0s and number of 1s) are distinct from those of any smaller number.
Binary analog of A179239 for n>=1.
All integers whose binary expression conforms to regex /^10*1*$/, shown in base 10 in ascending numeric order. (End)
Together with 0 all fixed points of A073137. - Alois P. Heinz, Jan 30 2025

Examples

			Triangle starts:                  In binary:
   k = 0  1  2  3  4  5
n
0      1                               1
1      2  3                           10     11
2      4  5  7                       100    101    111
3      8  9 11 15                   1000   1001   1011   1111
4     16 17 19 23 31               10000  10001  10011  10111  11111
5     32 33 35 39 47 63           100000 100001 100011 100111 101111 111111
E.g. T(5,3) = 2^5 + 2^3-1 = 32 + 7 = 39 (100111 in binary).
		

Crossrefs

A053221 (row sums), A000079 (left diagonal), A000225 (right diagonal).
A048645 (see formula).
Partial sums of A232089.

Programs

  • Haskell
    a099627 n k = a099627_tabl !! n !! k
    a099627_row n = a099627_tabl !! n
    a099627_tabl = iterate (\xs@(x:_) -> (2 * x) : map ((+ 1) . (* 2)) xs) [1]
    -- Reinhard Zumkeller, Dec 19 2012
  • Mathematica
    Table[2^n+2^k -1,{n,0,10},{k,0,n}]//Flatten (* Harvey P. Dale, Mar 27 2016 *)

Formula

As sequence, a(n) = A048645(n+2) - 1.
G.f.: (1 - x - x^2*y)/((1 - x)*(1 - 2*x)*(1 - x*y)*(1 - 2*x*y)). - Stefano Spezia, Aug 11 2024

A051382 Numbers k whose base 3 expansion matches (0|1)*(02)?(0|1)* (no more than one "02" allowed in midst of 0's and 1's).

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 13, 18, 19, 21, 22, 27, 28, 29, 30, 31, 33, 34, 36, 37, 38, 39, 40, 54, 55, 57, 58, 63, 64, 66, 67, 81, 82, 83, 84, 85, 87, 88, 90, 91, 92, 93, 94, 99, 100, 102, 103, 108, 109, 110, 111, 112, 114, 115, 117, 118, 119, 120, 121, 162, 163
Offset: 1

Views

Author

Keywords

Comments

Representation of 2n in base 3 consists entirely of 0's and 2's, except possibly for a single pair of adjacent 1's among them.
9 divides neither C(2s-1,s) [= A001700(s)] nor C(2s,s) [= A000984(s)] if and only if s = a(n). [Cf. also A249721].

Examples

			In base 3 the terms look like 0, 1, 2, 10, 11, 20, 21, 100, 101, 102, 110, 111, 200, 201, 210, 211, 1000, 1001, 1002, 1010, 1011, 1020, 1021, 1100, 1101, 1102, 1110, 1111, 2000, 2001, 2010, 2011, 2100, 2101, 2 110, 2111, 10000
		

Crossrefs

Complement: A249719.
Terms of A249721 halved.

Programs

  • Maple
    q:= n-> (l-> (h-> h=0 or h=1 and l[1+ListTools[Search](2, l)]
              =0 )(numboccur(l, 2)))([convert(n, base, 3)[], 0]):
    select(q, [$0..163])[];  # Alois P. Heinz, Jun 28 2021
  • PARI
    is(n)=my(v=digits(n,3)); for(i=1,#v, if(v[i]==2, if(i>1 && v[i-1], return(0)); for(j=i+1,#v, if(v[j]==2, return(0))); return(1))); 1 \\ Charles R Greathouse IV, Feb 23 2024
  • Perl
    sub conv_x_base_n { my($x, $b) = @_; my ($r, $z) = (0, ''); do { $r = $x % $b; $x = ($x - $r)/$b; $z = "$r" . $z; } while(0 != $x); return($z); }
    
  • Perl
    for($i=1; $i <= 201; $i++) { if(("0" . conv_x_base_n($i, 3)) =~ /^(0|1)*(02)?(0|1)*$/) { print $i, ", "; } }
    (Scheme, with Antti Karttunen's IntSeq-library)
    (define A051382 (MATCHING-POS 0 0 in_A051382?))
    (define (in_A051382? n) (let loop ((n n) (seen02yet? #f)) (cond ((zero? n) #t) ((= 1 n) #t) ((modulo n 3) => (lambda (r) (cond ((= r 2) (if (or seen02yet? (not (zero? (modulo (/ (- n r) 3) 3)))) #f (loop (/ (- n r) 3) #t))) (else (loop (/ (- n r) 3) seen02yet?))))))))
    
  • Python
    import re
    from sympy.ntheory.digits import digits
    def b3(n): return "".join(map(str, digits(n, 3)[1:]))
    def ok(n): return re.fullmatch('2(0|1)*|(0|1)*(02)?(0|1)*', b3(n)) != None
    print(list(filter(ok, range(164)))) # Michael S. Branicky, Jun 26 2021
    

Extensions

a(0) = 0 prepended as a border-line case by Antti Karttunen, Nov 14 2014
Offset changed to 1 by Georg Fischer, Jun 28 2021

A075897 1 if binary weight of n is 1 or 2, otherwise 0.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Benoit Cloitre, Mar 29 2003

Keywords

Crossrefs

Programs

  • Mathematica
    Table[If[MemberQ[{1,2},Total[IntegerDigits[n,2]]],1,0],{n,0,120}] (* Harvey P. Dale, Jul 26 2017 *)
  • PARI
    a(n)=(hammingweight(n)+1)\2 == 1 \\ Charles R Greathouse IV, Jan 10 2022
    
  • PARI
    a(n)=(hammingweight(n)) <= 2 && n > 0 \\ David A. Corneth, Jan 11 2022
    
  • Python
    def a(n): return int(bin(n).count('1') in [1, 2])
    print([a(n) for n in range(105)]) # Michael S. Branicky, Jan 11 2022

Formula

a(n) = 1 if n is in A048645, 0 otherwise.
For n>0: a(n) = 0^floor(A000120(n)/3). - Reinhard Zumkeller, Apr 07 2003

A048623 Binary encoding of semiprimes (A001358).

Original entry on oeis.org

2, 3, 4, 5, 9, 6, 10, 17, 8, 33, 18, 65, 12, 129, 34, 257, 16, 66, 20, 130, 513, 1025, 36, 258, 2049, 24, 4097, 68, 8193, 514, 40, 1026, 16385, 132, 32769, 2050, 260, 65537, 72, 32, 131073, 4098, 8194, 136, 262145, 16386, 524289, 48, 516, 1048577, 1028
Offset: 1

Views

Author

Antti Karttunen, Jul 14 1999

Keywords

Comments

Permutation of A048645 (without the term 1).

Examples

			Squares p_i^2 are encoded with a single bit in position i (e.g. 25=ithprime(3)*ithprime(3) => 2^3 = 8) and other terms p_i*p_j are encoded with two bits, as sum 2^(i-1)+2^(j-1)
		

Crossrefs

Programs

  • Maple
    nthprime := proc(n) local i; if(isprime(n)) then for i from 1 to 1000000 do if(ithprime(i) = n) then RETURN(i); fi; od; else RETURN(0); fi; end; # nthprime(2) = 1, nthprime(3) = 2, nthprime(5) = 3, etc.
    bef := proc(n) local s,d; s := 0; for d in ifactors(n)[ 2 ] do s := s + d[ 2 ]*(2^(nthprime(d[ 1 ])-1)); od; RETURN(s); end; # bef = Binary Encode Factorization.
    encode_semiprimes := proc(upto_n) local b,i; b := [ ]; for i from 1 to upto_n do if((3 = tau(i)) or ((0 <> mobius(i)) and (4 = tau(i)))) then b := [ op(b), bef(i) ]; fi; od: RETURN(b); end;
  • Mathematica
    f[n_] := Block[{p = FactorInteger@ n}, Total[2^PrimePi@ # &@ Map[First, p - If[Length@ p == 2, 1, 0]]]]; f /@ Select[Range@ 156, PrimeOmega@ # == 2 &] (* Michael De Vlieger, Oct 01 2015 *)
  • PARI
    lista(nn) = {for (n=1, nn, if (bigomega(n)==2, if (issquare(n), x = 2^primepi(sqrtint(n)), f = factor(n); x = sum(k=1, #f~, 2^(primepi(f[k,1]) - 1))); print1(x, ", ");););} \\ Michel Marcus, Oct 02 2015
    
  • Python
    from math import isqrt
    from sympy import primepi, primerange, factorint
    def A048623(n):
        def f(x): return int(n+x+((t:=primepi(s:=isqrt(x)))*(t-1)>>1)-sum(primepi(x//p) for p in primerange(s+1)))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return sum(e<Chai Wah Wu, Feb 22 2025

A059389 Sums of two nonzero Fibonacci numbers.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 18, 21, 22, 23, 24, 26, 29, 34, 35, 36, 37, 39, 42, 47, 55, 56, 57, 58, 60, 63, 68, 76, 89, 90, 91, 92, 94, 97, 102, 110, 123, 144, 145, 146, 147, 149, 152, 157, 165, 178, 199, 233, 234, 235, 236, 238, 241, 246, 254, 267
Offset: 1

Views

Author

Avi Peretz (njk(AT)netvision.net.il), Jan 29 2001

Keywords

Comments

The sums of two distinct nonzero Fibonacci numbers is essentially the same sequence: 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 18, 21, ... (only 2 is missing), since F(i) + F(i) = F(i-2) + F(i+1). - Colm Mulcahy, Mar 02 2008
To elaborate on Mulcahy's comment above: all terms of A078642 are in this sequence; those are numbers with two distinct representations as the sum of two Fibonacci numbers, which are, as Alekseyev proved, numbers of the form 2*F(i) greater than 2. - Alonso del Arte, Jul 07 2013

Examples

			10 is in the sequence because 10 = 2 + 8.
11 is in the sequence because 11 = 3 + 8.
12 is not in the sequence because no pair of Fibonacci numbers adds up to 12.
		

Crossrefs

Cf. A000045, A059390 (complement). Similar in nature to A048645. Essentially the same as A084176. Intersection with A049997 is A226857.

Programs

  • Maple
    N:= 1000: # to get all terms <= N
    R:= NULL:
    for j from 1 do
      r:= combinat:-fibonacci(j);
      if r > N then break fi;
      R:= R, r;
    end:
    R:= {R}:
    select(`<=`, {seq(seq(r+s, s=R),r=R)},N);
    # if using Maple 11 or earlier, uncomment the next line
    # sort(convert(%,list)); # Robert Israel, Feb 15 2015
  • Mathematica
    max = 13; Select[Union[Total/@Tuples[Fibonacci[Range[2, max]], {2}]], # <= Fibonacci[max] &] (* Harvey P. Dale, Mar 13 2011 *)
  • PARI
    list(lim)=my(upper=log(lim*sqrt(5))\log((1+sqrt(5))/2)+1, t, tt, v=List([2])); if(fibonacci(t)>lim,t--); for(i=3,upper, t=fibonacci(i); for(j=2,i-1,tt=t+fibonacci(j); if(tt>lim, break, listput(v,tt)))); vecsort(Vec(v)) \\ Charles R Greathouse IV, Jul 24 2012

Formula

a(1) = 2 and for n >= 2 a(n) = F_(trinv(n-2)+2) + F_(n-((trinv(n-2)*(trinv(n-2)-1))/2)) where F_n is the n-th Fibonacci number, F_1 = 1 F_2 = 1 F_3 = 2 ... and the definition of trinv(n) is in A002262. - Noam Katz (noamkj(AT)hotmail.com), Feb 04 2001
log a(n) ~ sqrt(n log phi) where phi is the golden ratio A001622. There are (log x/log phi)^2 + O(log x) members of this sequence up to x. - Charles R Greathouse IV, Jul 24 2012

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jan 31 2001

A249723 Numbers n such that there is a multiple of 9 on row n of Pascal's triangle with property that all multiples of 4 on the same row (if they exist) are larger than it.

Original entry on oeis.org

9, 10, 13, 15, 18, 19, 21, 27, 29, 31, 37, 39, 43, 45, 46, 47, 54, 55, 59, 63, 75, 79, 81, 82, 83, 85, 87, 90, 91, 93, 95, 99, 103, 109, 111, 117, 118, 119, 123, 126, 127, 135, 139, 151, 153, 154, 157, 159, 162, 163, 165, 167, 171, 175, 181, 183, 187, 189, 190, 191, 198, 199, 207, 219, 223, 225, 226, 229, 231, 234, 235, 237, 239, 243, 245, 247, 251, 253, 255
Offset: 1

Views

Author

Antti Karttunen, Nov 04 2014

Keywords

Comments

All n such that on row n of A095143 (Pascal's triangle reduced modulo 9) there is at least one zero and the distance from the edge to the nearest zero is shorter than the distance from the edge to the nearest zero on row n of A034931 (Pascal's triangle reduced modulo 4), the latter distance taken to be infinite if there are no zeros on that row in the latter triangle.
A052955 from its eight term onward, 31, 47, 63, 95, 127, ... seems to be a subsequence. See also the comments at A249441.

Examples

			Row 13 of Pascal's triangle (A007318) is: {1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1} and the term binomial(13, 5) = 1287 = 9*11*13 occurs before any term which is a multiple of 4. Note that one such term occurs right next to it, as binomial(13, 6) = 1716 = 4*3*11*13, but 1287 < 1716, thus 13 is included.
		

Crossrefs

Complement: A249724.
Natural numbers (A000027) is a disjoint union of the sequences A048278, A249722, A249723 and A249726.

Programs

  • PARI
    A249723list(upto_n) = { my(i=0, n=0); while(i
    				

A072823 Numbers that are not the sum of two powers of 2.

Original entry on oeis.org

1, 7, 11, 13, 14, 15, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 35, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 67, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97
Offset: 1

Views

Author

Jeremy Gardiner, Jul 21 2002

Keywords

Comments

1 and integers with three or more 1-bits in their binary expansion. - Vladimir Baltic, Jul 23 2002
Appears to be the numbers k >1 for which there exist an x and y (x>y) such that x OR y = k, x+y != k, and xGary Detlefs, Jun 02 2014

Crossrefs

Programs

  • Haskell
    a072823 n = a072823_list !! (n-1)
    a072823_list = tail $ elemIndices 0 a073267_list
    -- Reinhard Zumkeller, Mar 07 2012
    
  • Maple
    f:= x -> convert(convert(x,base,2),`+`)>2:
    {1} union select(f, {$2..1000}); # Robert Israel, Jun 08 2014
  • Mathematica
    Join[{1}, Select[Range[100], DigitCount[#, 2, 1] >= 3&]] (* Jean-François Alcover, Mar 08 2019 *)
  • Python
    from math import comb
    from itertools import count, islice
    def A072823(n):
        def f(x):
            s = bin(x)[2:]
            c = n-1+(l:=len(s))+comb(l-1,2)
            try:
                c += l-1-s[1:].index('1')
            except:
                pass
            return c
        m, k = n-1, f(n-1)
        while m != k: m, k = k, f(k)
        return m
    def A072823_gen(): # generator of terms
        return filter(lambda n:n==1 or n.bit_count()>2,count(1))
    A072823_list = list(islice(A072823_gen(),50)) # Chai Wah Wu, Oct 30 2024

Formula

A073267(a(n)) = 0. [Reinhard Zumkeller, Mar 07 2012]

A255366 Total number of ON cells at stage n of two-dimensional cellular automaton defined by the rules of the "Ulam-Warburton" two-dimensional cellular automaton (A147562) for two of its wedges and defined by "Rule 750" using the von Neumann neighborhood (A169707) for the two other wedges.

Original entry on oeis.org

1, 5, 9, 21, 25, 37, 53, 85, 89, 101, 117, 149, 165, 205, 257, 341, 345, 357, 373, 405, 421, 461, 513, 597, 613, 653, 705, 797, 857, 989, 1141, 1365, 1369, 1381, 1397, 1429, 1445, 1485, 1537, 1621, 1637, 1677, 1729, 1821, 1881, 2013, 2165, 2389, 2405, 2445, 2497
Offset: 1

Views

Author

Omar E. Pol, Feb 21 2015

Keywords

Comments

First differs from A162795 at a(14), but it appears that then they share infinitely many terms. It appears that this is very close to A162795 rather than both A147562 and A169707.
The graphs of both A162795 and this sequence are intertwined.
Note that there are four main versions of this cellular automaton, depending on whether the wedges with the same rule are opposite or perpendicular and also depending on whether each mentioned version is represented by the "one-step rook" illustration or by the "one-step bishop" illustration. The four versions are represented by this sequence.
a(43) = 1729 is also the Hardy-Ramanujan number.

Examples

			a(43) = (1705 + 1753)/2 = 3458/2 = 1729.
		

Crossrefs

Formula

a(n) = (A147562(n) + A169707(n))/2.
It appears that a(n) = A147562(n) = A162795(n) = A169709(n), if n is a member of A048645, or in other words: if the binary weight of n is 1 or 2, but note that a(n) = A162795(n) for many other values of n.

A249732 Number of (not necessarily distinct) multiples of 4 on row n of Pascal's triangle.

Original entry on oeis.org

0, 0, 0, 0, 2, 0, 1, 0, 6, 4, 3, 0, 7, 2, 3, 0, 14, 12, 11, 8, 13, 6, 7, 0, 19, 14, 11, 4, 17, 6, 7, 0, 30, 28, 27, 24, 29, 22, 23, 16, 33, 26, 23, 12, 29, 14, 15, 0, 43, 38, 35, 28, 37, 22, 23, 8, 45, 34, 27, 12, 37, 14, 15, 0, 62, 60, 59, 56, 61, 54, 55, 48, 65, 58, 55, 44, 61, 46, 47, 32
Offset: 0

Views

Author

Antti Karttunen, Nov 04 2014

Keywords

Comments

a(n) = Number of zeros on row n of A034931 (Pascal's triangle reduced modulo 4).
This should have a formula (see A048967).

Examples

			Row 9 of Pascal's triangle is: {1,9,36,84,126,126,84,36,9,1}. The terms 36 and 84 are only multiples of four, and both of them occur two times on that row, thus a(9) = 2*2 = 4.
Row 10 of Pascal's triangle is: {1,10,45,120,210,252,210,120,45,10,1}. The terms 120 (= 4*30) and 252 (= 4*63) are only multiples of four, and the former occurs twice, while the latter is alone at the center, thus a(10) = 2+1 = 3.
		

Crossrefs

Programs

  • PARI
    A249732(n) = { my(c=0); for(k=0,n\2,if(!(binomial(n,k)%4),c += (if(k<(n/2),2,1)))); return(c); } \\ Slow...
    for(n=0, 8192, write("b249732.txt", n, " ", A249732(n)));
    
  • Python
    def A249732(n): return n+1-(2+((n>>1)&~n).bit_count()<>1) # Chai Wah Wu, Jul 24 2025

Formula

Other identities:
a(n) <= A048277(n) for all n.
a(n) <= A048967(n) for all n.

A046097 Values of n for which binomial(2n-1, n) is squarefree.

Original entry on oeis.org

1, 2, 3, 4, 6, 9, 10, 12, 36
Offset: 1

Views

Author

Keywords

Comments

No more terms up to 2^300. The sequence is finite by results of Sander and of Granville and Ramaré (see links). - Robert Israel, Dec 10 2015

Crossrefs

Cf. A001700.
For a term to be here, it needs to be at least in the intersection of A048645, A051382, A050607, A050608 and an infinitude of similar sequences. The corresponding location in next-to-center column should be nonzero in A034931 (Pascal's triangle mod 4) and all similarly constructed fractal triangles (Pascal's triangle mod p^2).

Programs

  • Magma
    [n: n in [1..150] | IsSquarefree(Binomial(2*n-1,n))]; // Vincenzo Librandi, Dec 10 2015
  • Maple
    select(n -> numtheory:-issqrfree(binomial(2*n-1,n)), [$1..2000]); # Robert Israel, Dec 09 2015
    N:= 300: # to find all terms <= 2^N
    carries:= proc(n,m,p)
    # number of carries when adding n + m in base p.
    local A,B,C,j,nc, t;
       A:= convert(m,base,p);
       B:= convert(n,base,p);
    C:= 0; nc:= 0;
       if nops(A) < nops(B) then A = [op(A),0$(nops(B)-nops(A))]
       elif nops(A) > nops(B) then B:= [op(B), 0$(nops(A)-nops(B))]
       fi;
    for j from 1 to nops(A) do
        t:= C + A[j] + B[j];
        if t >= p then
           nc:= nc+1;
           C:= 1;
        else
           C:= 0
        fi
    od:
    nc;
    end proc:
    Cands:=  {seq(2^j,j=0..N), seq(seq(2^j + 2^k, k=0..j-1),j=1..N-1)}:
    for i from 2 to 10 do
      Cands:= select(n -> carries(n-1,n,ithprime(i)) <= 1, Cands)
    od:
    select(n -> numtheory:-issqrfree(binomial(2*n-1,n)),Cands); # Robert Israel, Dec 10 2015
  • Mathematica
    Select[ Range[1500], SquareFreeQ[ Binomial[ 2#-1, #]] &] (* Jean-François Alcover, Oct 25 2012 *)
  • PARI
    is(n)=issquarefree(binomial(2*n-1,n)) \\ Anders Hellström, Dec 09 2015
    

Extensions

James Sellers reports no further terms below 1500.
Michael Somos checked to 99999. Probably there are no more terms.
Mauro Fiorentini checked up to 2^64, as for n = 545259520, the binomial coefficient is a multiple of 5^4 and other possible exceptions have been checked (see Weisstein page for details).
Previous Showing 11-20 of 33 results. Next