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

A029744 Numbers of the form 2^n or 3*2^n.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152, 65536, 98304, 131072, 196608, 262144, 393216, 524288, 786432, 1048576, 1572864, 2097152, 3145728, 4194304
Offset: 1

Views

Author

Keywords

Comments

This entry is a list, and so has offset 1. WARNING: However, in this entry several comments, formulas and programs seem to refer to the original version of this sequence which had offset 0. - M. F. Hasler, Oct 06 2014
Number of necklaces with n-1 beads and two colors that are the same when turned over and hence have reflection symmetry. [edited by Herbert Kociemba, Nov 24 2016]
The subset {a(1),...,a(2k)} contains all proper divisors of 3*2^k. - Ralf Stephan, Jun 02 2003
Let k = any nonnegative integer and j = 0 or 1. Then n+1 = 2k + 3j and a(n) = 2^k*3^j. - Andras Erszegi (erszegi.andras(AT)chello.hu), Jul 30 2005
Smallest number having no fewer prime factors than any predecessor, a(0)=1; A110654(n) = A001222(a(n)); complement of A116451. - Reinhard Zumkeller, Feb 16 2006
A093873(a(n)) = 1. - Reinhard Zumkeller, Oct 13 2006
a(n) = a(n-1) + a(n-2) - gcd(a(n-1), a(n-2)), n >= 3, a(1)=2, a(2)=3. - Ctibor O. Zizka, Jun 06 2009
Where records occur in A048985: A193652(n) = A048985(a(n)) and A193652(n) < A048985(m) for m < a(n). - Reinhard Zumkeller, Aug 08 2011
A002348(a(n)) = A000079(n-3) for n > 2. - Reinhard Zumkeller, Mar 18 2012
Without initial 1, third row in array A228405. - Richard R. Forberg, Sep 06 2013
Also positions of records in A048673. A246360 gives the record values. - Antti Karttunen, Sep 23 2014
Known in numerical mathematics as "Bulirsch sequence", used in various extrapolation methods for step size control. - Peter Luschny, Oct 30 2019
For n > 1, squares of the terms can be expressed as the sum of two powers of two: 2^x + 2^y. - Karl-Heinz Hofmann, Sep 08 2022

Crossrefs

Cf. A056493, A038754, A063759. Union of A000079 and A007283.
First differences are in A016116(n-1).
Row sums of the triangle in sequence A119963. - John P. McSorley, Aug 31 2010
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A029744 = {s(n), n>=1}, the numbers 2^k and 3*2^k, as the parent. There may be minor differences from (s(n)) at the start, and a shift of indices. A029744 (s(n)); A052955 (s(n)-1), A027383 (s(n)-2), A354788 (s(n)-3), A060482 (s(n)-3); A136252 (s(n)-3); A347789 (s(n)-4), A209721 (s(n)+1), A209722 (s(n)+2), A343177 (s(n)+3), A209723 (s(n)+4); A354785 (3*s(n)), A061776 (3*s(n)-6); A354789 (3*s(n)-7). The first differences of A029744 are 1,1,1,2,2,4,4,8,8,... which essentially matches eight sequences: A016116, A060546, A117575, A131572, A152166, A158780, A163403, A320770. The bisections of A029744 are A000079 and A007283. - N. J. A. Sloane, Jul 14 2022

Programs

  • Haskell
    a029744 n = a029744_list !! (n-1)
    a029744_list = 1 : iterate
       (\x -> if x `mod` 3 == 0 then 4 * x `div` 3 else 3 * x `div` 2) 2
    -- Reinhard Zumkeller, Mar 18 2012
    
  • Maple
    1,seq(op([2^i,3*2^(i-1)]),i=1..100); # Robert Israel, Sep 23 2014
  • Mathematica
    CoefficientList[Series[(-x^2 - 2*x - 1)/(2*x^2 - 1), {x, 0, 200}], x] (* Vladimir Joseph Stephan Orlovsky, Jun 10 2011 *)
    Function[w, DeleteCases[Union@ Flatten@ w, k_ /; k > Max@ First@ w]]@ TensorProduct[{1, 3}, 2^Range[0, 22]] (* Michael De Vlieger, Nov 24 2016 *)
    LinearRecurrence[{0,2},{1,2,3},50] (* Harvey P. Dale, Jul 04 2017 *)
  • PARI
    a(n)=if(n%2,3/2,2)<<((n-1)\2)\1
    
  • Python
    def A029744(n):
        if n == 1: return 1
        elif n % 2 == 0: return 2**(n//2)
        else: return 3 * 2**((n-3)//2) # Karl-Heinz Hofmann, Sep 08 2022
  • Scheme
    (define (A029744 n) (cond ((<= n 1) n) ((even? n) (expt 2 (/ n 2))) (else (* 3 (expt 2 (/ (- n 3) 2)))))) ;; Antti Karttunen, Sep 23 2014
    

Formula

a(n) = 2*A000029(n) - A000031(n).
For n > 2, a(n) = 2*a(n - 2); for n > 3, a(n) = a(n - 1)*a(n - 2)/a(n - 3). G.f.: (1 + x)^2/(1 - 2*x^2). - Henry Bottomley, Jul 15 2001, corrected May 04 2007
a(0)=1, a(1)=1 and a(n) = a(n-2) * ( floor(a(n-1)/a(n-2)) + 1 ). - Benoit Cloitre, Aug 13 2002
(3/4 + sqrt(1/2))*sqrt(2)^n + (3/4 - sqrt(1/2))*(-sqrt(2))^n. a(0)=1, a(2n) = a(n-1)*a(n), a(2n+1) = a(n) + 2^floor((n-1)/2). - Ralf Stephan, Apr 16 2003 [Seems to refer to the original version with offset=0. - M. F. Hasler, Oct 06 2014]
Binomial transform is A048739. - Paul Barry, Apr 23 2004
E.g.f.: (cosh(x/sqrt(2)) + sqrt(2)sinh(x/sqrt(2)))^2.
a(1) = 1; a(n+1) = a(n) + A000010(a(n)). - Stefan Steinerberger, Dec 20 2007
u(2)=1, v(2)=1, u(n)=2*v(n-1), v(n)=u(n-1), a(n)=u(n)+v(n). - Jaume Oliver Lafont, May 21 2008
For n => 3, a(n) = sqrt(2*a(n-1)^2 + (-2)^(n-3)). - Richard R. Forberg, Aug 20 2013
a(n) = A064216(A246360(n)). - Antti Karttunen, Sep 23 2014
a(n) = sqrt((17 - (-1)^n)*2^(n-4)) for n >= 2. - Anton Zakharov, Jul 24 2016
Sum_{n>=1} 1/a(n) = 8/3. - Amiram Eldar, Nov 12 2020
a(n) = 2^(n/2) if n is even. a(n) = 3 * 2^((n-3)/2) if n is odd and for n>1. - Karl-Heinz Hofmann, Sep 08 2022

Extensions

Corrected and extended by Joe Keane (jgk(AT)jgk.org), Feb 20 2000

A003592 Numbers of the form 2^i*5^j with i, j >= 0.

Original entry on oeis.org

1, 2, 4, 5, 8, 10, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 128, 160, 200, 250, 256, 320, 400, 500, 512, 625, 640, 800, 1000, 1024, 1250, 1280, 1600, 2000, 2048, 2500, 2560, 3125, 3200, 4000, 4096, 5000, 5120, 6250, 6400, 8000, 8192, 10000, 10240, 12500, 12800
Offset: 1

Views

Author

Keywords

Comments

These are the natural numbers whose reciprocals are terminating decimals. - David Wasserman, Feb 26 2002
A132726(a(n), k) = 0 for k <= a(n); A051626(a(n)) = 0; A132740(a(n)) = 1; A132741(a(n)) = a(n). - Reinhard Zumkeller, Aug 27 2007
Where record values greater than 1 occur in A165706: A165707(n) = A165706(a(n)). - Reinhard Zumkeller, Sep 26 2009
Also numbers that are divisible by neither 10k - 7, 10k - 3, 10k - 1 nor 10k + 1, for all k > 0. - Robert G. Wilson v, Oct 26 2010
A204455(5*a(n)) = 5, and only for these numbers. - Wolfdieter Lang, Feb 04 2012
Since p = 2 and q = 5 are coprime, sum_{n >= 1} 1/a(n) = sum_{i >= 0} sum_{j >= 0} 1/p^i * 1/q^j = sum_{i >= 0} 1/p^i q/(q - 1) = p*q/((p-1)*(q-1)) = 2*5/(1*4) = 2.5. - Franklin T. Adams-Watters, Jul 07 2014
Conjecture: Each positive integer n not among 1, 4 and 12 can be written as a sum of finitely many numbers of the form 2^a*5^b + 1 (a,b >= 0) with no one dividing another. This has been verified for n <= 3700. - Zhi-Wei Sun, Apr 18 2023
1,2 and 4,5 are the only consecutive terms in the sequence. - Robin Jones, May 03 2025

References

  • Albert H. Beiler, Recreations in the theory of numbers, New York, Dover, (2nd ed.) 1966. See p. 73.

Crossrefs

Complement of A085837. Cf. A094958, A022333 (list of j), A022332 (list of i).
Cf. A164768 (difference between consecutive terms)

Programs

  • GAP
    Filtered([1..10000],n->PowerMod(10,n,n)=0); # Muniru A Asiru, Mar 19 2019
  • Haskell
    import Data.Set (singleton, deleteFindMin, insert)
    a003592 n = a003592_list !! (n-1)
    a003592_list = f $ singleton 1 where
       f s = y : f (insert (2 * y) $ insert (5 * y) s')
                   where (y, s') = deleteFindMin s
    -- Reinhard Zumkeller, May 16 2015
    
  • Magma
    [n: n in [1..10000] | PrimeDivisors(n) subset [2,5]]; // Bruno Berselli, Sep 24 2012
    
  • Maple
    isA003592 := proc(n)
          if n = 1 then
            true;
        else
            return (numtheory[factorset](n) minus {2,5} = {} );
        end if;
    end proc:
    A003592 := proc(n)
         option remember;
         if n = 1 then
            1;
        else
            for a from procname(n-1)+1 do
                if isA003592(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc: # R. J. Mathar, Jul 16 2012
  • Mathematica
    twoFiveableQ[n_] := PowerMod[10, n, n] == 0; Select[Range@ 10000, twoFiveableQ] (* Robert G. Wilson v, Jan 12 2012 *)
    twoFiveableQ[n_] := Union[ MemberQ[{1, 3, 7, 9}, # ] & /@ Union@ Mod[ Rest@ Divisors@ n, 10]] == {False}; twoFiveableQ[1] = True; Select[Range@ 10000, twoFiveableQ] (* Robert G. Wilson v, Oct 26 2010 *)
    maxExpo = 14; Sort@ Flatten@ Table[2^i * 5^j, {i, 0, maxExpo}, {j, 0, Log[5, 2^(maxExpo - i)]}] (* Or *)
    Union@ Flatten@ NestList[{2#, 4#, 5#} &, 1, 7] (* Robert G. Wilson v, Apr 16 2011 *)
  • PARI
    list(lim)=my(v=List(),N);for(n=0,log(lim+.5)\log(5),N=5^n;while(N<=lim,listput(v,N);N<<=1));vecsort(Vec(v)) \\ Charles R Greathouse IV, Jun 28 2011
    
  • Python
    # A003592.py
    from heapq import heappush, heappop
    def A003592():
        pq = [1]
        seen = set(pq)
        while True:
            value = heappop(pq)
            yield value
            seen.remove(value)
            for x in 2*value, 5*value:
                if x not in seen:
                    heappush(pq, x)
                    seen.add(x)
    sequence = A003592()
    A003592_list = [next(sequence) for _ in range(100)]
    
  • Python
    from sympy import integer_log
    def A003592(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum((x//5**i).bit_length() for i in range(integer_log(x,5)[0]+1))
        return bisection(f,n,n) # Chai Wah Wu, Feb 24 2025
    
  • Sage
    def isA003592(n) :
        return not any(d != 2 and d != 5 for d in prime_divisors(n))
    @CachedFunction
    def A003592(n) :
        if n == 1 : return 1
        k = A003592(n-1) + 1
        while not isA003592(k) : k += 1
        return k
    [A003592(n) for n in (1..48)]  # Peter Luschny, Jul 20 2012
    

Formula

The characteristic function of this sequence is given by Sum_{n >= 1} x^a(n) = Sum_{n >= 1} mu(10*n)*x^n/(1 - x^n), where mu(n) is the Möbius function A008683. Cf. with the formula of Hanna in A051037. - Peter Bala, Mar 18 2019
a(n) ~ exp(sqrt(2*log(2)*log(5)*n)) / sqrt(10). - Vaclav Kotesovec, Sep 22 2020
a(n) = 2^A022332(n) * 5^A022333(n). - R. J. Mathar, Jul 06 2025

Extensions

Incomplete Python program removed by David Radcliffe, Jun 27 2016

A005767 Solutions n to n^2 = a^2 + b^2 + c^2 (a,b,c > 0).

Original entry on oeis.org

3, 6, 7, 9, 11, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85
Offset: 1

Views

Author

N. J. A. Sloane, Ralph Peterson (ralphp(AT)library.nrl.navy.mil)

Keywords

Comments

All numbers not equal to some 2^k or 5*2^k [Fraser and Gordon]. - Joseph Biberstine (jrbibers(AT)indiana.edu), Jul 28 2006

References

  • T. Nagell, Introduction to Number Theory, Wiley, 1951, p. 194.

Crossrefs

Complement of A094958. Cf. A169580, A000378, A000419, A000408.
For primitive solutions see A005818.

Programs

  • Mathematica
    z=100;lst={};Do[a2=a^2;Do[b2=b^2;Do[c2=c^2;e2=a2+b2+c2;e=Sqrt[e2];If[IntegerQ[e]&&e<=z,AppendTo[lst,e]],{c,b,1,-1}],{b,a,1,-1}],{a,1,z}];Union@lst (* Vladimir Joseph Stephan Orlovsky, May 19 2010 *)
  • PARI
    is(n)=if(n%5,n,n/5)==2^valuation(n,2) \\ Charles R Greathouse IV, Mar 12 2013
    
  • Python
    def A005767(n):
        def f(x): return n+x.bit_length()+(x//5).bit_length()
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Feb 14 2025

Formula

a(n) = n + 2*log_2(n) + O(1). - Charles R Greathouse IV, Sep 01 2015
A169580(n) = a(n)^2. - R. J. Mathar, Aug 15 2023

Extensions

More terms from T. D. Noe, Mar 04 2010

A181786 Number of inequivalent solutions to n^2 = a^2 + b^2 + c^2 with positive a, b, c.

Original entry on oeis.org

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

Views

Author

T. D. Noe, Nov 12 2010

Keywords

Comments

Note that a(n)=0 for n=0 and the n in A094958.
Also note that a(2n)=a(n), e.g., a(1000)=a(500)=a(250)=a(125)=14. - Zak Seidov, Mar 02 2012
a(n) is the number of distinct parallelepipeds each one having integer diagonal n and integer sides. - César Eliud Lozada, Oct 26 2014

Crossrefs

Programs

  • Mathematica
    nn=100; t=Table[0,{nn}]; Do[n=Sqrt[a^2+b^2+c^2]; If[n<=nn && IntegerQ[n], t[[n]]++], {a,nn}, {b,a,nn}, {c,b,nn}]; Prepend[t,0]

A164682 a(n) = 2*a(n-2) for n > 2; a(1) = 5, a(2) = 8.

Original entry on oeis.org

5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1024, 1280, 2048, 2560, 4096, 5120, 8192, 10240, 16384, 20480, 32768, 40960, 65536, 81920, 131072, 163840, 262144, 327680, 524288, 655360, 1048576, 1310720, 2097152, 2621440, 4194304
Offset: 1

Views

Author

Klaus Brockhaus, Aug 21 2009

Keywords

Comments

Interleaving of A020714 and A000079 without initial terms 1, 2, 4.
First differences are in A162255.
Binomial transform is A135532 without initial terms -1, 3. Fourth binomial transform is A164537.

Crossrefs

Equals A094958 (numbers of the form 2^n or 5*2^n) without initial terms 1, 2, 4.
Cf. A020714 (5*2^n), A000079 (powers of 2), A162255, A135532, A164537.

Programs

  • Magma
    [ n le 2 select 2+3*n else 2*Self(n-2): n in [1..40] ];
  • Mathematica
    LinearRecurrence[{0,2},{5,8},60] (* Harvey P. Dale, Jul 20 2022 *)

Formula

a(n) = (9-(-1)^n)*2^(1/4*(2*n-5+(-1)^n)).
G.f.: x*(5+8*x)/(1-2*x^2).

A181787 Number of solutions to n^2 = a^2 + b^2 + c^2 with positive a, b, c.

Original entry on oeis.org

0, 0, 0, 3, 0, 0, 3, 6, 0, 12, 0, 9, 3, 6, 6, 15, 0, 9, 12, 15, 0, 33, 9, 18, 3, 12, 6, 39, 6, 18, 15, 24, 0, 48, 9, 30, 12, 24, 15, 45, 0, 27, 33, 33, 9, 60, 18, 36, 3, 48, 12, 60, 6, 36, 39, 45, 6, 78, 18, 45, 15, 42, 24, 114, 0, 36, 48, 51, 9, 93, 30, 54, 12, 51, 24, 87, 15, 87, 45, 60, 0, 120, 27, 63, 33, 51, 33, 105, 9, 63, 60, 84, 18, 123, 36, 75, 3, 69, 48, 165, 12
Offset: 0

Views

Author

T. D. Noe, Nov 12 2010

Keywords

Comments

Note that a(n)=0 for n=0 and the n in A094958.

Examples

			a(3)=3 because 3^2 = 1^2+2^2+2^2 = 2^2+1^2+2^2 = 2^2+2^2+1^2. - _Robert Israel_, Aug 02 2019
		

Crossrefs

Programs

  • Maple
    N:= 200: # for a(0)..a(N)
    A:= Array(0..N):
    mults:= [1,3,6]:
    for a from 1 while 3*a^2 <= N^2 do
      if a::odd then b0:= a+1; db:= 2 else b0:= a; db:= 1 fi;
      for b from b0 by db while a^2 + 2*b^2 <= N^2 do
        if (a+b)::odd then c0:= b + (b mod 2); dc:= 2 else c0:= b; dc:= 1 fi;
        for c from c0 by dc do
          v:= a^2 + b^2 + c^2;
          if v > N^2 then break fi;
          if issqr(v) then
            w:= sqrt(v);
            A[w]:= A[w]+ mults[nops({a,b,c})];
          fi
    od od od:
    convert(A,list); # Robert Israel, Aug 02 2019
  • Mathematica
    nn=100; t=Table[0,{nn}]; Do[n=Sqrt[a^2+b^2+c^2]; If[n<=nn && IntegerQ[n], t[[n]]++], {a,nn}, {b,nn}, {c,nn}]; Prepend[t,0]

Formula

a(n) = A063691(n^2). - Michel Marcus, Apr 25 2015
a(2*n) = a(n). - Robert Israel, Aug 02 2019

A164053 Partial sums of A162255.

Original entry on oeis.org

3, 5, 11, 15, 27, 35, 59, 75, 123, 155, 251, 315, 507, 635, 1019, 1275, 2043, 2555, 4091, 5115, 8187, 10235, 16379, 20475, 32763, 40955, 65531, 81915, 131067, 163835, 262139, 327675, 524283, 655355, 1048571, 1310715, 2097147, 2621435, 4194299
Offset: 1

Views

Author

Klaus Brockhaus, Aug 08 2009

Keywords

Comments

Apparently a(n) = A094958(n+4)-5.

Crossrefs

Programs

  • Magma
    T:=[ n le 2 select 4-n else 2*Self(n-2): n in [1..39] ]; [ n eq 1 select T[1] else Self(n-1)+T[n]: n in [1..#T]];
    
  • Mathematica
    Accumulate[LinearRecurrence[{0,2},{3,2},50]] (* or *) LinearRecurrence[ {1,2,-2},{3,5,11},50] (* Harvey P. Dale, Aug 28 2012 *)
  • PARI
    x='x+O('x^50); Vec(x*(3+2*x)/(1-x-2*x^2+2*x^3)) \\ G. C. Greubel, Sep 09 2017

Formula

a(n) = 2*a(n-2) + 5 for n > 2; a(1) = 3, a(2) = 5.
a(n) = (13 - 3*(-1)^n)*2^(1/4*(2*n -1 +(-1)^n))/2 - 5.
G.f.: x*(3+2*x)/(1-x-2*x^2+2*x^3).
a(1)=3, a(2)=5, a(3)=11, a(n)=a(n-1)+2*a(n-2)-2*a(n-3). - Harvey P. Dale, Aug 28 2012

A292895 a(n) is the least positive k such that the Hamming weight of k equals the Hamming weight of k + n.

Original entry on oeis.org

1, 1, 2, 1, 4, 5, 2, 1, 8, 3, 10, 6, 4, 5, 2, 1, 16, 3, 6, 5, 20, 3, 12, 10, 8, 9, 10, 6, 4, 5, 2, 1, 32, 3, 6, 5, 12, 3, 10, 9, 40, 11, 6, 5, 24, 3, 20, 18, 16, 7, 18, 17, 20, 12, 12, 10, 8, 9, 10, 6, 4, 5, 2, 1, 64, 3, 6, 5, 12, 3, 10, 9, 24, 11, 6, 5, 20, 3, 18, 17, 80, 7, 22, 14, 12, 13, 10, 9, 48
Offset: 0

Views

Author

Rémy Sigrist and Altug Alkan, Sep 26 2017

Keywords

Comments

Inspired by A292849.
The Hamming weight of a number n is given by A000120(n).
Let b(n) be the smallest t such that a(t) = n. Initial values of b(n) are 0, 2, 9, 4, 5, 11, 49, 8, 25, 10, 41, 22, 85, 83, 225, 16, 51, 47, 177, 20, ... See the logarithmic line graph of first 10^3 terms of b(n) sequence in Links section.
Apparently, n = a(n) iff n belongs to A094958. - Rémy Sigrist, Oct 02 2017

Examples

			a(49) = 7 since A000120(7) = A000120(7 + 49) and 7 is the least number with this property.
		

Crossrefs

Programs

  • Maple
    N:= 1000: # to get all terms before the first where n+a(n)>N
    H:= Array(0..N, t -> convert(convert(t,base,2),`+`)):
    f:= proc(n) local k;
      for k from 1 to N-n do
        if H[k]=H[k+n] then return k fi
      od:
    0
    end proc:
    R:= NULL:
    for n from 0 do
    v:= f(n);
    if v = 0 then break fi;
      R:= R, v;
    od:
    R; # Robert Israel, Sep 27 2017
  • Mathematica
    h[n_] := First@ DigitCount[n, 2]; a[n_] := Block[{k=1}, While[h[k] != h[k + n], k++]; k]; Array[a, 90] (* Giovanni Resta, Sep 28 2017 *)
  • PARI
    a(n) = {my(k=1); while ((hammingweight(k)) != hammingweight(n+k), k++); k; }

Formula

a(n) <= n for n >= 1.
a(2*n) = 2*a(n) for n >= 1.
a(2^m) = 2^m and a(5*2^m) = 5*2^m for m >= 0.
a(2^m - 1) = 1 for m >= 0.
a(2^m + 1) = 3 and a(2^m - 3) = 5 for m >= 3.
a(2^m + 3) = 5 for m >= 4.
a((2^m - 1)^2) = 2^m - 1 for m >= 1.
a(2^(m + 2) + 2^m - 1) = 2^m + 1 m >= 1.
a((2^m + 1)^2) = 7 for m >= 3.

A298359 Lexicographically earliest sequence of distinct positive terms such that, for any n > 0, Sum_{k = 1..n} 10^(k-1) * a(k) can be computed without carry in decimal base.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 40, 41, 42, 43, 44, 45, 50, 51, 52, 53, 54, 60, 61, 62, 63, 70, 71, 72, 80, 81, 90, 100, 19, 37, 46, 55, 64, 73, 82, 91, 110, 28, 56, 74
Offset: 1

Views

Author

Rémy Sigrist, Jan 17 2018

Keywords

Comments

More informally: write the terms in decimal under each other, right-justified; the digits on each diagonal in downwards direction sum at most to 9.
The corresponding sequence for base 2 is A094958.
See also A298425 for a similar sequence.

Examples

			The first terms, alongside 10^(n-1) * a(n), are:
  n   a(n)  10^(n-1) * a(n)
  --  ----  -------------------
   1   1                      1
   2   2                     20
   3   3                    300
   4   4                   4000
   5   5                  50000
   6   6                 600000
   7   7                7000000
   8   8               80000000
   9   9              900000000
  10  10            10000000000
  11  11           110000000000
  12  12          1200000000000
  13  13         13000000000000
  14  14        140000000000000
  15  15       1500000000000000
  16  16      16000000000000000
  17  17     170000000000000000
  18  18    1800000000000000000
  19  20   20000000000000000000
  20  21  210000000000000000000
The terms on the third column can be summed without carry in decimal base.
		

Crossrefs

Programs

  • PARI
    See Links section.

A029745 Expansion of (1 + 2x + 6x^2 + x^3)/(1 - 2x^2).

Original entry on oeis.org

1, 2, 8, 5, 16, 10, 32, 20, 64, 40, 128, 80, 256, 160, 512, 320, 1024, 640, 2048, 1280, 4096, 2560, 8192, 5120, 16384, 10240, 32768, 20480, 65536, 40960, 131072, 81920, 262144, 163840, 524288, 327680, 1048576, 655360, 2097152, 1310720, 4194304
Offset: 1

Views

Author

Keywords

Comments

Note that 4 is the only power of 2 not here. All terms are either 2^k or 5*2^k.

Crossrefs

Cf. A094958 (numbers of the form 2^k or 5*2^k).

Programs

  • Mathematica
    LinearRecurrence[{0,2},{1,2,8,5},50] (* or *) With[{nn=20},Join[{1,2}, Riffle[ 8*2^Range[0,nn],5 2^Range[0,nn]]]] (* Harvey P. Dale, Sep 28 2016 *)
  • PARI
    a(n)=if(n<2,1+max(-1,n),2^(n\2)*if(n%2,5/2,4))

Formula

G.f.: (1 + 2x + 6x^2 + x^3)/(1 - 2x^2).
Sum_{n>=1} 1/a(n) = 43/20. - Amiram Eldar, Jan 21 2022

Extensions

Edited by T. D. Noe, Nov 12 2010
Showing 1-10 of 15 results. Next