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: James Kilfiger

James Kilfiger's wiki page.

James Kilfiger has authored 18 sequences. Here are the ten most recent ones:

A335099 Lexicographically earliest sequence of distinct integers greater than 1 such that a(n) mod a(i)^2 >= a(i) for all i < n.

Original entry on oeis.org

2, 3, 6, 7, 14, 15, 22, 23, 26, 30, 31, 34, 35, 42, 43, 58, 59, 62, 66, 67, 70, 71, 78, 79, 86, 87, 94, 95, 106, 107, 114, 115, 122, 123, 130, 131, 134, 138, 139, 142, 143, 158, 159, 166, 167, 170, 174, 175, 178, 179, 186, 187, 194, 195, 210, 211, 214, 215, 222
Offset: 1

Author

James Kilfiger, Sep 12 2020 (suggested by student)

Keywords

Comments

In the sieve of Eratosthenes, first the even numbers are removed, then the multiples of 3, then multiples of 5. In this sieve first the numbers greater than 2 and modulo 0 or 1 (mod 4) are removed leaving (1) 2, 3, 6, 7, 10, 11, 14, 15. Then the numbers greater than 3 and modulo 0, 1, 2 (mod 9) are removed leaving (1) 2, 3, 6, 7, 14, 15. Then numbers modulo 0, 1, 2, 3, 4, 5 (mod 36) are removed.

Crossrefs

Programs

  • Maple
    N:= 1000: # for terms <= N
    R:= NULL:
    Cands:= [$2..N]:
    while Cands <> [] do
      r:= Cands[1];
      R:= R,r;
      Cands:= select(t -> t mod r^2 >= r, Cands[2..-1]);
    od:
    R; # Robert Israel, Sep 05 2024
  • PARI
    seq(n)={my(a=vector(n), k=1); for(n=1, #a, while(1, k++; my(f=1); for(i=1, n-1, if(k%a[i]^2Andrew Howroyd, Sep 12 2020
  • Python3
    from math import sqrt
    length=100
    s=list(range(2,length))
    for p in range(int(sqrt(length))):
        x = s[p]
        if x==0 : continue
        for i,e in enumerate(s):
            if e>x and e%(x*x)
    				

Extensions

Terms a(29) and beyond from Andrew Howroyd, Sep 12 2020

A288782 Integers k that have the property that there exists an integer x with n+1 digits, such that 1 <= k/x < 2 and k/x = 1 + (x-10^n)/(10^n-1), i.e., the same digits appear in the denominator and in the recurring decimal.

Original entry on oeis.org

10, 34, 100, 208, 238, 394, 1000, 1680, 2898, 3994, 10000, 14938, 16198, 22348, 22648, 29830, 31600, 39994, 100000, 109994, 137694, 149380, 316048, 333630, 380720, 399994, 1000000, 1010610, 1079440, 1306120, 1318244, 1396694, 1409228, 1460458, 1738920, 1768810, 1826150
Offset: 1

Author

James Kilfiger, Jun 15 2017

Keywords

Comments

The values 399..994 all seem to appear.

Crossrefs

Cf. A285273, A288781 (denominators).

Programs

  • Mathematica
    Union @@ Reap[ Do[Sow[k /. List@ToRules@ Reduce[k/x == 1 + (x - 10^n)/(10^n - 1) &&  10^n <= x < 10^(n + 1) && x <= k < 2 x, {k, x}, Integers]], {n, 6}]][[2, 1]] (* Giovanni Resta, Jun 30 2017 *)
  • Python
    from math import sqrt
    def is_square(n):
      root = int(sqrt(n))
      return root*root == n
    def find_sols(length):
        count = 0
        k=10**length
        for n in range(k,4*k-2):
            discr= (2*k-1)*(2*k-1) - 4*(k*(k-1)-(k-1)*n)
            if is_square(discr):
                count+=1
                b=(-(2*k-1)+sqrt(discr))/2
                print(n, k+b, n/(k+b))
        return count
    for i in range(8):
        print(find_sols(i))

Extensions

Definition corrected by Giovanni Resta, Jun 30 2017

A288781 Integers x with h+1 digits that have the property that there exists an integer k, with x <= k < 2*x, such that k/x = 1 + (x-10^h)/(10^h-1), i.e., the same digits appear in the denominator and in the recurring decimal.

Original entry on oeis.org

10, 18, 100, 144, 154, 198, 1000, 1296, 1702, 1998, 10000, 12222, 12727, 14949, 15049, 17271, 17776, 19998, 100000, 104878, 117343, 122221, 177777, 182655, 195120, 199998, 1000000, 1005291, 1038961, 1142856, 1148148, 1181818, 1187109, 1208494, 1318681
Offset: 1

Author

James Kilfiger, Jun 15 2017

Keywords

Comments

The numbers appear to be in pairs that add up to 299...998; e.g., 144 + 154 = 298, 12222 + 17776 = 29998.

Crossrefs

Cf. A285273, A288782 (numerators).

Programs

  • Mathematica
    Union @@ Reap[Do[Sow[x /. List@ ToRules@ Reduce[k/x == 1 + (x - 10^n)/(10^n - 1) &&  10^n <= x < 10^(n + 1) && x <= k < 2 x, {k, x}, Integers]], {n, 6}]][[2, 1]] (* Giovanni Resta, Jun 30 2017 *)
  • Python
    from math import sqrt
    def is_square(n):
      root = int(sqrt(n))
      return root*root == n
    def find_sols(length):
        count = 0
        k=10**length
        for n in range(k,4*k-2):
            discr= (2*k-1)*(2*k-1) - 4*(k*(k-1)-(k-1)*n)
            if is_square(discr):
                count+=1
                b=(-(2*k-1)+sqrt(discr))/2
                print(n, k+b, n/(k+b))
        return count
    for i in range(8):
        print(find_sols(i))

Extensions

Definition corrected by and more terms from Giovanni Resta, Jun 30 2017

A285273 Number of integers, x, with n+1 digits, that have the property that there exists an integer k, with x <= k < 2*x, such that k/x = 1 + (x-10^n)/(10^n-1), i.e., the same digits appear in the denominator and in the recurring decimal.

Original entry on oeis.org

2, 4, 4, 8, 8, 32, 8, 32, 8, 32, 8, 128, 16, 32, 64, 128, 8, 256, 4, 256, 128, 128, 4, 1024, 64, 128, 32, 512, 64, 8192, 16, 4096, 64, 128, 256, 2048, 16, 16, 64, 4096, 32, 16384, 32, 2048, 512, 128, 8, 8192, 32, 2048, 256, 1024, 32, 4096, 512, 8192, 64, 512, 8
Offset: 1

Author

James Kilfiger, Jun 14 2017

Keywords

Comments

This was suggested by generalizing an exam question which asked "Jack typed a whole number into his calculator and divided by 154. The result was 1.545454545. What was his number?"
It appears that a(n) is always a power of 2.

Examples

			The number 154 has the property that there exists an integer, 238, for which
     238/154 = 1 + 54/99 = 1.545454545...
There are 4 three-digit values that give rise to a 2-digit recurring decimal:
  100/100.0 = 1.0000000000000000
  208/144.0 = 1.4444444444444444...
  238/154.0 = 1.5454545454545454...
  394/198.0 = 1.9898989898989898...
thus a(2) = 4.
For n=3, a(3) = 8:
  10000/10000.0 = 1.0000000000000000
  14938/12222.0 = 1.2222222222222222...
  16198/12727.0 = 1.2727272727272727...
  22348/14949.0 = 1.4949494949494949...
  22648/15049.0 = 1.5049504950495049...
  29830/17271.0 = 1.7271727172717271...
  31600/17776.0 = 1.7776777677767776...
  39994/19998.0 = 1.9998999899989998...
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Length@ List@ ToRules@ Reduce[k/x == 1 + (x-10^n)/(10^n-1) && 10^n <= x < 10^(n+1) && x <= k < 2 x, {k, x}, Integers]; Array[a, 20] (* for n<60, Giovanni Resta, Jun 30 2017 *)
  • Python
    from math import sqrt
    def is_square(n):
      root = int(sqrt(n))
      return root*root == n
    def find_sols(length):
        count = 0
        k=10**length
        for n in range(k,4*k-2):
            discr= (2*k-1)*(2*k-1) - 4*(k*(k-1)-(k-1)*n)
            if is_square(discr):
                count+=1
                b=(-(2*k-1)+sqrt(discr))/2
                print(n, k+b, n/(k+b))
        return count
    for i in range(8):
        print(find_sols(i))

Extensions

Definition corrected and a(11)-a(59) from Giovanni Resta, Jun 30 2017

A014701 Number of multiplications to compute n-th power by the Chandah-sutra method.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, 5, 6, 6, 7, 6, 7, 7, 8, 6, 7, 7, 8, 7, 8, 8, 9, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 8, 9, 8, 9, 9, 10, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 8, 9, 8, 9, 9, 10, 7, 8, 8, 9, 8, 9, 9
Offset: 1

Author

James Kilfiger (jamesk(AT)maths.warwick.ac.uk)

Keywords

Comments

In other words, number of steps to reach 1 starting from n and using the process: x -> x-1 if n is odd and x -> x/2 otherwise.
a(n) = number of 0's + twice number of 1's (disregarding the leading digit 1) in the binary expansion of n, i.e., A007088(n). - Lekraj Beedassy, May 28 2010
From Daniel Forgues, Jul 31 2012: (Start)
For the binary Fibonacci rabbits sequence (A036299) (cf. OEIS Wiki link below) we have the substitution/concatenation rule: a(n), n >= 3, may be obtained by the concatenation of a(n-1) and a(n-2), with a(1) = 0, a(2) = 1. Thus, using . (dot) as the concatenation operator, we have the recursive substitution/concatenation
a(n) = a(n-0)
a(n) = a(n-1).a(n-2)
a(n) = a(n-2).a(n-3).a(n-3).a(n-4)
a(n) = a(n-3).a(n-4).a(n-4).a(n-5).a(n-4).a(n-5).a(n-5).a(n-6)
which suggests the sequence
{0}
{1, 2}
{2, 3, 3, 4}
{3, 4, 4, 5, 4, 5, 5, 6}
whose concatenation gives A014701 (this sequence).
Number of multiplications to compute n-th power by the Chandah-sutra method, also called left-to-right binary exponentiation:
x^1 = x^( 1_2) = (x) (0 prod)
x^2 = x^( 10_2) = (x^2) (1 prod)
x^3 = x^( 11_2) = (x^2) * (x) (2 prod)
x^4 = x^( 100_2) = (x^2)^2 (2 prod)
x^5 = x^( 101_2) = (x^2)^2 * (x) (3 prod)
x^6 = x^( 110_2) = (x^2)^2 * (x^2) (3 prod)
x^7 = x^( 111_2) = (x^2)^2 * (x^2) * (x) (4 prod)
x^8 = x^(1000_2) = ((x^2)^2)^2 (3 prod) (End)
From Ya-Ping Lu, Mar 03 2021: (Start)
Index at which record m occurs is A052955(m).
First appearance of m in the sequence (or the record value m) is at n = 2^(m/2 + 1) - 1 for even m, and at n = 3*2^((m - 1)/2) - 1 for odd m.
The last appearance of m in the sequence is at n = 2^m. (End)
a(n) is the digit sum of n-1 in bijective base-2. Since the Fibonacci number F(m) can be defined as the number of ways to compose m as the sum of 1s and 2s, we get that m appears F(m) times in the sequence. - Oscar Cunningham, Apr 14 2024
Conjecture: a(n+1) is the minimal number of steps to go from 0 to n, by choosing before each step, after the first step, whether to keep the same step length or double it. The initial step length is 1. - Jean-Marc Rebert, May 15 2025

Examples

			5 -> 4 -> 2 -> 1 so 3 steps are needed to reach 1 hence a(5)=3; 9 -> 8 -> 4 -> 2 -> 1 hence a(9)=4.
		

Crossrefs

Programs

  • Haskell
    a014701 1 = 0
    a014701 n = a007953 $ a007931 (n - 1)
    -- Reinhard Zumkeller, Oct 26 2012
    
  • Maple
    A014701 := proc(n) local j,k; j := n; k := 0; while(j>1) do if j mod 2=1 then j := j-1 else j := j/2 fi; k := k+1 od end;
    # second Maple program:
    a:= n-> add(i+1, i=Bits[Split](n))-2:
    seq(a(n), n=1..128);  # Alois P. Heinz, Aug 30 2021
  • Mathematica
    a[n_] := DigitCount[n, 2] /. {x_, y_} -> 2x + y - 2; Array[a, 100] (* Robert G. Wilson v, Jul 31 2012 *)
  • PARI
    a(n)=hammingweight(n)+logint(n,2)-1 \\ Charles R Greathouse IV, Dec 29 2016
    
  • Python
    def a(n):
        if n==1:
            return 0
        return a(n//2)+1+n%2
    for i in range(1,60):
        print(a(i), end=", ")
    # Pablo Hueso Merino, Oct 28 2020

Formula

a(n) = A056792(n) - 1 = A056791(n) - 2.
a(n) = floor(log_2(n)) + (number of 1's in binary representation of n) - 1. - Corrected (- 1 at end) by Daniel Forgues, Aug 01 2012
a(2^n) = n, a(2^n-1) = 2*(n-1), and for n >= 2, log_2(n) <= a(n) <= 2*log_2(n) - 1. - Robert FERREOL, Oct 01 2014
Let u(1) = 1, u(2*n) = u(n)+1, u(2*n+1) = u(2*n)+1; then a(1) = 0 and a(n) = u(n-1). - Benoit Cloitre, Dec 19 2002
G.f.: -2/(1-x) + (1/(1-x)) * Sum_{k>=0} (2*x^2^k + x^2^(k+1))/(1+x^2^k). - Ralf Stephan, Aug 15 2003
From {0}, apply the substitution rule (n -> n+1, n+2) repeatedly, giving {{0}, {1, 2}, {2, 3, 3, 4}, {3, 4, 4, 5, 4, 5, 5, 6}, ...} and concatenate. - Daniel Forgues, Jul 31 2012
For n > 1: a(n) = A007953(A007931(n-1)). - Reinhard Zumkeller, Oct 26 2012
a(n) >= A003313(n). - Charles R Greathouse IV, Jan 03 2018
a(n) = a(floor(n/2)) + 1 + (n mod 2) for n > 1. - Pablo Hueso Merino, Oct 28 2020
a(n+1) = max_{1<=i<=n} (H(i) + H(n-i)) where H(n) denotes the Hamming weight of n (A000120(n)). See Lemma 8 in Gruber/Holzer 2021 article. - Hermann Gruber, Jun 26 2024

A009287 a(1) = 3; thereafter a(n+1) = least k with a(n) divisors.

Original entry on oeis.org

3, 4, 6, 12, 60, 5040, 293318625600, 670059168204585168371476438927421112933837297640990904154667968000000000000
Offset: 1

Author

David W. Wilson and James Kilfiger (jamesk(AT)maths.warwick.ac.uk)

Keywords

Comments

The sequence must start with 3, since a(1)=1 or a(1)=2 would lead to a constant sequence. - M. F. Hasler, Sep 02 2008
The calculation of a(7) and a(8) is based upon the method in A037019 (which, apparently, is the method previously used by the authors of A009287). So a(7) and a(8) are correct unless n=a(6)=5040 or n=a(7)=293318625600 are "exceptional" as described in A037019. - Rick L. Shepherd, Aug 17 2006
a(7) is correct because 5040 is not exceptional (see A072066). - T. D. Noe, Sep 02 2008
Terms from a(2) to a(7) are highly composite (that is, found in A002182), but a(8) is not. - Ivan Neretin, Mar 28 2015 [Equivalently, the first 6 terms are in A002183, but a(7) is not. Note that the smallest number with at least a(7) divisors is A002182(695) ~ 1.77 * 10^59 with 293534171136 divisors, which is much smaller than a(8) ~ 6.70 * 10^75. - Jianing Song, Jul 15 2021]
Grime reported that Ramanujan unfortunately missed a(7) with 5040 divisors. - Frank Ellermann, Mar 12 2020
It is possible to prepend 2 to this sequence as follows. a(0) = 2; for n > 0, a(n) = the smallest natural number greater than a(n-1) with a(n-1) divisors. - Hal M. Switkay, Jul 03 2022

Examples

			5040 is the smallest number with 60 divisors.
		

References

  • Amarnath Murthy, Pouring a few more drops in the ocean of Smarandache Sequences and Conjectures (to be published in the Smarandache Notions Journal) [Note: this author submitted two erroneous versions of this sequence to the OEIS, A036460 and A061080, entries which contained invalid conjectures.]

Crossrefs

Coincides with A251483 for 1 <= n <= 7 (only).

Programs

  • Mathematica
    f[n_] := Block[{k = 3, s = (Times @@ (Prime[Range[Length@ #]]^Reverse[# - 1])) & @ Flatten[FactorInteger[#] /. {a_Integer, b_} :> Table[a, {b}]] & /@ Range@ 10000}, Reap@ Do[Sow[k = s[[k]]], {n}] // Flatten // Rest]; f@ 6 (* Michael De Vlieger, Mar 28 2015, after Wouter Meeussen at A037019 *)

Formula

a(n) = A005179(a(n-1)).

Extensions

Entry revised by N. J. A. Sloane, Aug 25 2006

A013608 7^n-prevprime(7^n).

Original entry on oeis.org

2, 2, 6, 2, 20, 6, 2, 2, 6, 8, 44, 2, 36, 32, 2, 24, 36, 50, 92, 18, 6, 32, 86, 60, 6, 50, 12, 2, 186, 18, 2, 72, 6, 12, 60, 12, 260, 116, 86, 24, 96, 102, 66, 44, 18, 86, 110, 48, 6, 8, 72, 212, 138, 6, 104, 138, 90, 270, 114, 152, 30, 150, 50, 150, 66, 170
Offset: 1

Author

James Kilfiger (mapdn(AT)csv.warwick.ac.uk)

Keywords

Programs

  • Maple
    seq(7^i-prevprime(7^i),i=1..100);

A013598 a(n) = nextprime(3^n)-3^n.

Original entry on oeis.org

1, 2, 2, 2, 2, 8, 4, 16, 2, 4, 2, 20, 16, 8, 2, 2, 26, 34, 10, 56, 8, 56, 4, 32, 2, 14, 2, 16, 26, 130, 4, 16, 70, 70, 34, 22, 2, 50, 8, 82, 118, 70, 4, 52, 8, 46, 68, 52, 56, 16, 28, 34, 50, 26, 28, 20, 62, 4, 158, 64, 16, 34, 122, 2, 92, 64, 28, 230, 20
Offset: 0

Author

James Kilfiger (mapdn(AT)csv.warwick.ac.uk)

Keywords

Crossrefs

Cf. A013604.

Programs

  • Maple
    seq(nextprime(3^i)-3^i,i=0..100);
  • Mathematica
    np[n_]:=Module[{c=3^n},NextPrime[c]-c]; Array[np,80,0] (* Harvey P. Dale, Jul 14 2014 *)

Formula

a(n) = A151800(3^n)-3^n = A013632(3^n). - R. J. Mathar, Nov 28 2016

Extensions

Corrected by Harvey P. Dale, Jul 14 2014

A013602 a(n) = nextprime(4^n)-4^n.

Original entry on oeis.org

1, 1, 1, 3, 1, 7, 3, 27, 1, 3, 7, 15, 43, 15, 3, 3, 15, 25, 31, 7, 15, 15, 7, 15, 21, 55, 21, 159, 81, 69, 33, 135, 13, 9, 33, 25, 15, 37, 15, 7, 13, 9, 3, 27, 7, 133, 25, 129, 61, 7, 277, 267, 111, 99, 33, 27, 25, 43, 33, 25, 451, 277, 67, 7, 51, 169, 67, 27, 85, 87
Offset: 0

Author

James Kilfiger (mapdn(AT)csv.warwick.ac.uk)

Keywords

Crossrefs

Programs

  • Maple
    seq(nextprime(4^i)-4^i,i=0..100);
  • Mathematica
    np4[n_]:=Module[{c=4^n},NextPrime[c]-c]; Array[np4,70,0] (* Harvey P. Dale, Jan 23 2012 *)
  • PARI
    a(n) = nextprime(4^n)-4^n; \\ Michel Marcus, Aug 13 2019

Formula

a(n) = A104082(n) - A000302(n). - Michel Marcus, Aug 13 2019
a(n) = A013597(2*n), n >= 0. - A.H.M. Smeets, Aug 13 2019

A013601 a(n) = nextprime(7^n)-7^n.

Original entry on oeis.org

1, 4, 4, 4, 10, 4, 10, 4, 16, 4, 18, 10, 16, 40, 4, 66, 6, 24, 48, 24, 16, 52, 102, 4, 46, 60, 10, 24, 76, 10, 114, 18, 90, 40, 24, 36, 6, 72, 22, 24, 232, 10, 54, 60, 216, 160, 174, 34, 48, 24, 382, 88, 48, 10, 124, 10, 58, 34, 132, 214, 46, 22, 40, 136
Offset: 0

Author

James Kilfiger (mapdn(AT)csv.warwick.ac.uk)

Keywords

Crossrefs

Programs

  • Maple
    seq(nextprime(7^i)-7^i,i=0..100);
  • PARI
    a(n) = nextprime(7^n+1) - 7^n; \\ Michel Marcus, Aug 13 2019

Formula

a(n) = A063767(n)-7^n = A013632(7^n). - R. J. Mathar, Nov 28 2016