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.

Showing 1-10 of 13 results. Next

A215246 a(n) = maximal value of k such that A215244(k) = n.

Original entry on oeis.org

2, 6, 13, 22, 26, 41, 50, 54, 89, 105, 101, 109, 178, 166, 118, 185, 217, 218, 201, 357, 361, 358, 422, 329, 434, 425, 429, 418, 617, 441, 666, 717, 845, 722, 745, 741, 718, 873, 869, 841, 846, 1430, 882, 844, 866, 934, 946, 1446, 1434, 885, 1690, 1625, 1445, 1686, 949, 1714, 1497
Offset: 1

Views

Author

N. J. A. Sloane, Aug 07 2012

Keywords

Examples

			A215244(k) = 4 for k = 7,8,12,14,18,22, so a(4) = 22.
		

Crossrefs

Programs

  • Maple
    # Since A214245(12)=95, the following program gives correct values for a(n) for n <= 94.
    A215246:=proc(M) local lis,n,p,i;
    lis:=array(1..1024);
    for n from 1 to M do
    p:=A215244(n);
    if p <= 1024 then lis[p]:=n; fi;
                      od;
    [seq(lis[i],i=1..94)];
    end proc;
    A215246(2^12 - 1);

A215245 a(n) = minimal value of A215244(k) for 2^n <= k < 2^(n+1).

Original entry on oeis.org

1, 1, 2, 3, 4, 6, 9, 13, 20, 29, 42, 65, 95, 136, 212, 308, 444, 687, 1005, 1439, 2242, 3257, 4696, 7266, 10629, 15219
Offset: 0

Views

Author

N. J. A. Sloane, Aug 07 2012

Keywords

Comments

The initial terms roughly satisfy a(n) approx.= a(n-1)+a(n-3), which leads to the guess that perhaps a(n) ~ 1.4655^n, from the real zero of x^3-x-1. - N. J. A. Sloane, Aug 08 2012

Examples

			The values of A215244(k) for k=8 through 15 are (4, 3, 3, 3, 4, 3, 4, 8), with minimal value a(3) = 3.
		

Crossrefs

Cf. A215244, A215246, A215253, A215254. A215255 gives an upper bound.

Programs

  • Maple
    A215245 := proc(n)
        local a,k ;
        a := A215244(2^n) ;
        for k from 2^n+1 to 2^(n+1)-1 do
            a := min(a,A215244(k)) ;
        end do:
        a ;
    end proc: # R. J. Mathar, Aug 07 2012
  • Mathematica
    palQ[L_] := SameQ[L, Reverse[L]];
    b[L_] := b[L] = Module[{a = palQ[L] // Boole, c}, For[c = 1, c < Length[L], c++, If[palQ[L[[;; c]]], a = a + b[L[[c+1 ;;]]]]]; a];
    a215244[n_] := If[n == 1, 1, b[IntegerDigits[n, 2]]];
    a215245[n_] := Module[{a, k}, a = a215244[2^n]; For[k = 2^n+1, k <= 2^(n+1) - 1, k++, a = Min[a, a215244[k]]]; a];
    a215245 /@ Range[0, 20] (* Jean-François Alcover, Oct 28 2019 *)

Extensions

a(10)-a(13) from R. J. Mathar, Aug 07 2012
a(14)-a(17) from N. J. A. Sloane, Aug 08 2012, using Mathar's Maple code.
a(18)-a(25) from Giovanni Resta, Mar 19 2013

A215254 Consider numbers m in the range 2^n <= m < 2^(n+1); the smallest A215244(m) in this range is k=A215245(n); a(n) = binary representation of m for the first time this k appears.

Original entry on oeis.org

1, 10, 100, 1001, 10010, 100101, 1001101, 10010110, 101001101, 1001011001, 10010110010, 100101100101, 1001101001101, 10010110010110, 101001101001101, 1001011001011001, 10010110010110010, 100101100101100101
Offset: 0

Views

Author

N. J. A. Sloane, Aug 14 2012

Keywords

Comments

a(n) is an example, the first that is encountered, of a binary vector of length n that has the smallest number of factorizations as a product of palindromes.

Examples

			If the numbers are written under each other, there is a suggestion of a pattern (see A215255 for the most obvious pattern). It would be interesting to have more terms to see if the pattern continues.
   0  1                            1
   1  10                           10
   2  100                          100
   3  1001                         1001
   4  10010                        10010
   5  100101                       a
   6  1001101                      b1
   7  10010110                     a10
   8  101001101                    10b1
   9  1001011001                   a1001
  10  10010110010                  a10010
  11  100101100101                 aa
  12  1001101001101                bb1
  13  10010110010110               aa10
  14  101001101001101              10bb1
  15  1001011001011001             aa1001
  16  10010110010110010            aa10010
  17  100101100101100101           aaa
  18  1001101001101001101          bbb1
  19  10010110010110010110         aaa10
  20  101001101001101001101        10bbb1
  21  1001011001011001011001       aaa1001
  22  10010110010110010110010      aaa10010
  23  100101100101100101100101     aaaa
  24  1001101001101001101001101    bbbb1
  25  10010110010110010110010110   aaaa10
  26  101001101001101001101001101  10bbbb1
The rightmost column is obtained by substituting a=100101 and b=100110. A period of 6 is apparent. - _Lars Blomberg_, May 18 2019
		

Crossrefs

Extensions

Example augmented by Lars Blomberg, May 18 2019

A215250 a(n) = number of values k >= 0 such that A215244(k) = n.

Original entry on oeis.org

3, 4, 4, 6, 6, 6, 5, 11, 5, 11, 10, 6, 11, 7, 2, 22, 15, 13, 4, 12, 14, 10, 17, 9, 10, 25, 8, 10, 10, 14, 16, 24, 13, 24, 9, 14, 12, 18, 16, 16, 21, 32, 18, 15, 6, 20, 20, 16, 20, 6, 23, 26, 16, 16, 14, 26, 21, 28, 13, 24, 22, 14, 16, 33, 17, 32, 15, 36, 18, 26, 18
Offset: 1

Views

Author

N. J. A. Sloane, Aug 11 2012

Keywords

Examples

			A215244 takes the value 4 exactly 6 times, so a(4) = 6.
		

A050430 Length of longest palindromic subword of (n base 2).

Original entry on oeis.org

1, 1, 2, 2, 3, 2, 3, 3, 4, 3, 3, 2, 3, 3, 4, 4, 5, 4, 4, 3, 5, 4, 3, 3, 4, 3, 5, 3, 3, 4, 5, 5, 6, 5, 5, 5, 4, 4, 4, 3, 4, 5, 5, 4, 6, 5, 4, 4, 5, 4, 6, 3, 5, 5, 5, 3, 4, 3, 5, 4, 4, 5, 6, 6, 7, 6, 6, 5, 5, 5, 5, 5, 7, 5, 4, 6, 4, 5, 4, 4, 5, 6, 4, 5, 7, 5, 5, 4, 4, 6, 6, 5, 7, 6, 5, 5, 6, 5, 7, 5, 4, 6, 6, 3, 4
Offset: 1

Views

Author

Keywords

Comments

a(A083318(n-1)) = n; a(A193159(k)) = 3, 1 <= k <= 26. [Reinhard Zumkeller, Jul 17 2011]

Examples

			(11 base 2) = 1011, containing the palindrome 101, therefore a(11) = 3.
		

Crossrefs

Cf. A007088; A050431 (base 3), A050432 (base 4), A050433 (base 5).

Programs

  • Haskell
    import Data.Char (intToDigit, digitToInt)
    import Numeric (showIntAtBase)
    a050430 n = a050430_list !! (n-1)
    a050430_list = f 1 where
       f n = g (showIntAtBase 2 intToDigit n "") : f (n+1)
       g zs | zs == reverse zs = length zs
            | otherwise        = max (h $ init zs) (h $ tail zs)
       h zs@('0':_) = g zs
       h zs@('1':_) = a050430 $ foldl (\v d -> digitToInt d + 2*v) 0 zs
    -- Reinhard Zumkeller, Jul 16 2011
  • Maple
    # A050430 Length of longest palindromic factor of n for n in [M1..M2] - from N. J. A. Sloane, Aug 07 2012, revised Aug 11 2012
    isPal := proc(L)
        local d ;
        for d from 1 to nops(L)/2 do
            if op(d, L) <> op(-d, L) then
                return false;
            end if;
        end do:
        return true;
    end proc:
    # start of main program
    ans:=[];
    M1:=0; M2:=64;
    for n from M1 to M2 do
    t1:=convert(n,base,2);
    rec:=0:
    l1:=nops(t1);
    for j1 from 0 to l1-1 do
    for j2 from j1+1 to l1 do
    F1 := [op(j1+1..j2,t1)];
    if (isPal(F1) and j2-j1>rec) then rec:=j2-j1; fi;
    od:
    od:
    ans:=[op(ans),rec]:
    od:
    ans;
  • Mathematica
    f[n_] := Block[{id = IntegerDigits[n, 2]}, k = Length@ id; While[ Union[# == Reverse@# & /@ Partition[id, k, 1]][[-1]] != True, k--]; k]; Array[f, 105] (* Robert G. Wilson v, Jul 16 2011 *)

Formula

a(n) <= min(a(2*n), a(2*n+1)). [Reinhard Zumkeller, Jul 31 2011]

Extensions

Extended by Ray Chandler, Mar 11 2010

A063782 a(0) = 1, a(1) = 3; for n > 1, a(n) = 2*a(n-1) + 4*a(n-2).

Original entry on oeis.org

1, 3, 10, 32, 104, 336, 1088, 3520, 11392, 36864, 119296, 386048, 1249280, 4042752, 13082624, 42336256, 137003008, 443351040, 1434714112, 4642832384, 15024521216, 48620371968, 157338828800, 509159145472, 1647673606144
Offset: 0

Views

Author

Klaus E. Kastberg (kastberg(AT)hotkey.net.au), Aug 17 2001

Keywords

Comments

Ratio of successive terms approaches sqrt(5) + 1.
From Sean A. Irvine, Jun 06 2025: (Start)
Also, number of walks of length n starting at vertex 1 in the following graph:
1---2
|\ /|
| 0 |
|/ \|
4---3. (End)

Examples

			As the INVERT transform of A006138, (1, 2, 5, 11, 26, 59, ...); a(4) = 104 = (26, 11, 5, 2, 1) dot (1, 1, 3, 10, 32) = (26 + 11 + 15 + 20 + 32).
		

Crossrefs

Cf. A006138. Row sums of A215244.

Programs

  • Maple
    a := proc(n) option remember: if n=0 then RETURN(1) fi: if n=1 then RETURN(2) fi: 2*a(n-1) + 4*a(n-2); end: for n from 1 to 50 do printf(`%d,`,a(n)+a(n-1)) od:
    f:=n-> simplify(expand((1/2)*(1+sqrt(5))^n + (1/5)*(1+sqrt(5))^n*sqrt(5) - (1/5)*sqrt(5)*(1-sqrt(5))^n + (1/2)*(1 -sqrt(5))^n )); # N. J. A. Sloane, Aug 10 2012
  • Mathematica
    a[n_]:=(MatrixPower[{{1,5},{1,1}},n].{{2},{1}})[[2,1]]; Table[a[n],{n,0,40}] (* Vladimir Joseph Stephan Orlovsky, Feb 20 2010 *)
    LinearRecurrence[{2, 4}, {1, 3}, 100] (* G. C. Greubel, Feb 18 2017 *)
  • PARI
    { for (n=0, 200, if (n>1, a=2*a1 + 4*a2; a2=a1; a1=a, if (n, a=a1=2, a=a2=1)); if (n, write("b063782.txt", n, " ", a + a2)) ) } \\ Harry J. Smith, Aug 31 2009

Formula

For n >= 1, a(n) = 2^(n-1)*Fibonacci(n+3). - Vladeta Jovovic, Oct 25 2003
G.f.: (1 + x)/(1 - 2*x - 4*x^2). - R. J. Mathar, Feb 06 2010
Equals INVERT transform of A006138 and INVERTi transform of A179606. - Gary W. Adamson, Aug 14 2010
a(n) = (1/2)*(1+sqrt(5))^n + (1/5)*(1+sqrt(5))^n*sqrt(5) - (1/5)*sqrt(5)*(1-sqrt(5))^n + (1/2)*(1-sqrt(5))^n. - Alexander R. Povolotsky, Aug 15 2010
It follows that a(n) is the nearest integer to (and is increasingly close to) (1/2 + 1/sqrt(5))*(1+sqrt(5))^n. - N. J. A. Sloane, Aug 10 2012
a(n) = A063727(n) + A063727(n-1).
a(n) = M^n(1, 1), with the matrix M= [[3, 1], [1, -1]]. Proof by Cayley-Hamilton, using S(n, -I) = (-I)^n*F(n+1), and S = A049310 and F = A000045. Motivated by A319053. - Wolfdieter Lang, Oct 08 2018

Extensions

More terms from James Sellers, Sep 25 2001
Edited (new offset, new initial term, etc.) by N. J. A. Sloane, Aug 19 2010

A206925 Number of contiguous palindromic bit patterns in the binary representation of n.

Original entry on oeis.org

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

Views

Author

Hieronymus Fischer, Mar 12 2012

Keywords

Comments

The number of contiguous palindromic bit patterns in the binary representation of n is a measure for the grade of symmetry in an abstract arrangement of two kinds of elements (where the number of elements is the number of binary digits, of course).
The minimum value for a(n) is 2*floor(log_2(n)) and will be taken infinitely often (see A206926 and A206927). This means: For a given number of places m there are at least 2*(m-1) palindromic substrings in the binary representation. This lower bound indicates to a certain extent the minimal possible symmetry.

Examples

			a(1) = 1, since 1 = 1_2 is the only palindromic bit pattern;
a(4) = 4, since 4 = 100_2 and there are the following palindromic bit patterns: 1, 0, 0, 00;
a(5) = 4, since 5 = 101_2 and there are the following palindromic bit patterns: 1, 0, 1, 101;
a(8) = 7, since 8 = 1000_2 and there are the following palindromic bit patterns: 1, 0, 0, 0, 00, 00, 000.
		

Crossrefs

Programs

  • Haskell
    import Data.Map (fromList, (!), insert)
    import Data.List (inits, tails)
    a206925 n = a206925_list !! (n-1)
    a206925_list = 1 : f [0, 1] (fromList [(Bin [0], 1), (Bin [1], 1)]) where
       f bs'@(b:bs) m = y : f (succ bs') (insert (Bin bs') y m) where
         y = m ! (Bin bs) +
             length (filter (\ds -> ds == reverse ds) $ tail $ inits bs')
         succ [] = [1]; succ (0:ds) = 1 : ds; succ (1:ds) = 0 : succ ds
    -- Reinhard Zumkeller, Dec 17 2012
    
  • PARI
    a(n)=n=binary(n);sum(k=0,#n-1,sum(i=1,#n-k,prod(j=0, k\2,n[i+j]==n[i+k-j]))) \\ Charles R Greathouse IV, Mar 21 2012
    
  • Python
    def A206925(n):
        s = bin(n)[2:]
        k = len(s)
        return sum(1 for i in range(k) for j in range(i+1,k+1) if s[i:j] == s[j-1:i-1-k:-1]) # Chai Wah Wu, Jan 31 2023
  • Smalltalk
    A206925
    "Answers the number of symmetric bit patterns of n as a binary."
    | m p q n numSym |
    n := self.
    n < 2 ifTrue: [^1].
    m := n integerFloorLog: 2.
    p := n printStringRadix: 2.
    numSym := 0.
    1 to: m + 1
      do:
       [:k |
       1 to: k
        do:
         [:j |
         q := p copyFrom: j to: k.
         q = q reverse ifTrue: [numSym := numSym + 1]]].
    ^numSym // Hieronymus Fischer, Feb 16 2013
    

Formula

a(n) <= (m+1)*(m+2)/2, where m = floor(log_2(n)); equality holds if n + 1 is a power of 2.
a(n) >= 2*floor(log_2(n)).
This estimation cannot be improved in general, since equality holds for A206926(n): a(A206926(n)) = 2*floor(log_2(A206926(n))).
Asymptotic behavior:
a(n) = O(log(n)^2).
lim sup a(n)/log_2(n)^2 = 1/2, for n --> infinity.
lim inf a(n)/log_2(n) = 2, for n --> infinity.

Extensions

Comments and formulas added by Hieronymus Fischer, Jan 23 2013

A301453 a(n) is the number of ways of writing the binary expansion of n as a concatenation of nonempty substrings with no two consecutive equal substrings.

Original entry on oeis.org

1, 1, 2, 1, 3, 4, 3, 3, 6, 7, 7, 6, 5, 6, 6, 4, 10, 13, 14, 11, 11, 14, 14, 12, 9, 11, 11, 9, 9, 12, 10, 7, 17, 23, 26, 20, 20, 26, 25, 21, 23, 26, 28, 22, 22, 27, 26, 20, 16, 20, 22, 17, 17, 22, 20, 18, 18, 21, 23, 18, 16, 20, 17, 14, 31, 40, 46, 36, 39, 49
Offset: 0

Views

Author

Rémy Sigrist, Apr 08 2018

Keywords

Comments

Leading zeros in the binary expansion of n are ignored.
The value a(0) = 1 corresponds to the empty concatenation.
The following sequences f correspond to the numbers of ways of writing the binary expansion of a number as a concatenation of substrings with some specific features:
f f(2^n-1) Features
------- -------- --------
A215244 A011782 Substrings are palindromes.
A301453 A003242 This sequence; no two consecutive equal substrings.
A302395 A032020 All substrings are distinct.
A302436 A000012 Substrings with Hamming weight at most 1.
A302437 A000045 Substrings with Hamming weight at most 2.
A302439 A000012 Substrings are aperiodic.
For any such sequence f, the function n -> f(2^n-1) corresponds to a composition of n.

Examples

			For n = 19: the binary expansion of 19, "10011", can be split in 11 ways into nonempty substrings with no two consecutive equal substrings:
- (10011),
- (1001)(1),
- (100)(11),
- (10)(011),
- (10)(01)(1),
- (10)(0)(11),
- (1)(0011),
- (1)(001)(1),
- (1)(00)(11),
- (1)(0)(011),
- (1)(0)(01)(1).
Hence a(19) = 11.
		

Crossrefs

Programs

  • PARI
    a(n{, pp=0}) = if (n==0, return (1), my (v=0, p=1); while (n, p=(p*2) + (n%2); n\=2; if (p!=pp, v+=a(n, p))); return (v))

Formula

a(2^n - 1) = A003242(n) for any n >= 0.

A215253 a(n) = decimal equivalent of A215254(n).

Original entry on oeis.org

1, 2, 4, 9, 18, 37, 77, 150, 333, 601, 1202, 2405, 4941, 9622, 21325, 38489, 76978, 153957
Offset: 1

Views

Author

N. J. A. Sloane, Aug 14 2012

Keywords

Crossrefs

A215255 Let S be the binary string consisting of the first n digits of (100101)*; a(n) = number of ways of writing S as a product of palindromes.

Original entry on oeis.org

1, 1, 2, 3, 4, 6, 10, 13, 23, 29, 42, 65, 107, 136, 243, 308, 444, 687, 1131, 1439, 2570, 3257, 4696, 7266, 11962, 15219, 27181, 34447, 49666, 76847, 126513, 160960, 287473, 364320, 525280, 812753, 1338033, 1702353, 3040386, 3853139
Offset: 0

Views

Author

N. J. A. Sloane, Aug 14 2012

Keywords

Comments

If S is the binary representation of the decimal number N, then a(n) = A215244(N).
a(n) is an upper bound for A215245(n), which might be tight infinitely often.

Crossrefs

Formula

Recurrence: For n >= 4, a(n) = a(n-1)+a(n-d), where d = [3,2,4,2,4,3] according as n == [0,1,2,3,4,5] mod 6; initial conditions a(0)=a(1)=a(2)=1, a(3)=2.
G.f.: (x^17+x^14+x^12+5*x^11+2*x^10-x^9+3*x^8+3*x^7+6*x^5+4*x^4+3*x^3+2*x^2+x+1)/(1-10*x^6-6*x^12-x^18).
a(n) ~ C * D^n, where D = 1.4815692... and C depends on n mod 6 (approximate values of C are [0.580722..., 0.6452899..., 0.554135..., 0.667994..., 0.571395..., 0.556061...], respectively).
Showing 1-10 of 13 results. Next