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: Christian Perfect

Christian Perfect's wiki page.

Christian Perfect has authored 27 sequences. Here are the ten most recent ones:

A356739 a(n) is the smallest k such that k! has at least n consecutive zeros immediately after the leading digit in base 10.

Original entry on oeis.org

7, 153, 197, 7399, 24434, 24434, 9242360, 238861211, 238861211
Offset: 1

Author

Christian Perfect, Aug 25 2022

Keywords

Examples

			a(1) = 7, because 7! = 5040 has one zero immediately after the leading digit, and there is no k<7 with that property.
		

Crossrefs

Programs

  • Python
    from itertools import count
    t = 1
    n = 1
    for k in count(1):
        t *= k
        while str(t)[1:1+n] == '0'*n:
            print(n,k)
            n += 1

Extensions

a(5)-a(6) from Amiram Eldar, Aug 25 2022
a(7)-a(9) from Jinyuan Wang, Aug 25 2022

A343934 Irregular triangle read by rows: row n gives the sequence of iterations of k - A006519(k), starting with k=n, until 0 is reached.

Original entry on oeis.org

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

Author

Christian Perfect, May 04 2021

Keywords

Comments

Row n starts with n, then the highest power of 2 dividing n is subtracted to produce the next entry in the row.
n first appears at position A000788(n)+1.

Examples

			The triangle begins
1
2
3 2
4
5 4
6 4
7 6 4
		

Crossrefs

Cf. A000120 (row widths), A000788, A006519, A129760, A298011 (row sums).

Programs

  • Mathematica
    Table[Most @ NestWhileList[# - 2^IntegerExponent[#, 2] &, n, # > 0 &], {n, 1, 30}] // Flatten (* Amiram Eldar, May 05 2021 *)
  • Python
    def gen_a():
        for n in range(1,100):
            k = n
            while k>0:
                yield k
                k = k & (k-1)
    a = gen_a()

A338807 Numbers k such that the process starting at (k, 0) mapping (k, t) to (k+1, t+k) if t = 0 (mod k), and (k-1, t+k) otherwise, eventually reaches (1, T) for some T.

Original entry on oeis.org

1, 2, 8, 9, 11, 14, 18, 20, 23, 32, 35, 38, 40, 47, 49, 50, 53, 56, 57, 58, 59, 62, 67, 71, 73, 74, 77, 89, 91, 92, 95, 98, 101, 104, 106, 114, 116, 128, 134, 135, 137, 140, 148, 149, 152, 155, 156, 158, 159, 162, 164, 169, 172, 173, 185, 188, 191, 194, 197
Offset: 1

Author

Christian Perfect, Nov 10 2020

Keywords

Comments

At each step, let the state of the process be (i,t), i_max the greatest i seen so far and i_min > 1 the least i seen so far. Consider the triples (i,j,t%j) for 2 <= j <= i_max, where i_max is the largest i seen so far. If all of those triples have been seen in previous steps, then the next step will not produce a new triple either, so the process will never reach i=1.

Examples

			For k = 8, the process stops at T = 57: (8,0), (9,8), (8,17), (7,25), (6,32), (5,38), (4,43), (3,47), (2,50), (3,52), (2,55), (1,57).
For k = 4, the process never stops: (4,0), (5,4), (4,9), (3,13), (2,16), (3,18), (4,21), ...
		

Programs

  • Python
    def isok(n):
        t = 0
        seen = set()
        maxn = n
        steps = 0
        while n>1:
            maxn = max(maxn,n)
            tuples = set((n,m,t%m) for m in range(2,maxn+1))
            if tuples <= seen:
                break
            seen = seen.union(tuples)
            t += n
            if t%n==0:
                n += 1
            else:
                n -= 1
        return n==1

A326930 Height of the smallest stack in a block-stacking sequence.

Original entry on oeis.org

1, 3, 3, 3, 7, 6, 7, 8, 13, 10, 13, 12, 13, 15, 15, 15, 17, 21, 19, 21, 21, 21, 25, 24, 25, 27, 27, 27, 31, 30, 31, 32, 35, 34, 35, 39, 37, 39, 39, 39, 43, 42, 43, 44, 49, 46, 49, 48, 49, 51, 51, 51, 55, 54, 55, 56, 61, 58, 61, 60, 61, 63, 63, 63, 65, 69, 67, 69, 69, 69, 71, 75
Offset: 1

Author

Christian Perfect, Oct 22 2019

Keywords

Comments

This sequence describes a block-stacking process: at step 1, start with a single stack of height 1. At step n>1, if n is less than or equal to the height of the smallest stack, start a new stack of height n. Otherwise, add n to the height of the smallest stack.

Programs

  • PARI
    seq(n)={my(L=List(), a=vector(n)); for(n=1, #a, if(#L && L[1]Andrew Howroyd, Oct 22 2019
  • Python
    def seq():
        towers = [0]
        for i in range(1, 100):
            towers = sorted(towers)
            if i <= towers[0]:
                towers = [i] + towers
            else:
                towers = [towers[0] + i] + towers[1:]
            yield min(towers)
    

A283714 a(n) is the first occurrence after a(n-1) of the n-th digit in the decimal expansion of Pi-3, beginning with a(0)=1.

Original entry on oeis.org

1, 3, 19, 37, 48, 55, 63, 69, 90, 91, 109, 113, 122, 139, 144, 170, 173, 194, 197, 201, 211, 221, 226, 227, 230, 231, 233, 237, 241, 242, 247, 252, 264, 275, 279, 305, 321, 324, 328, 343, 344, 347, 353, 358, 388, 391, 401, 405, 411, 417, 421, 444, 447, 456, 493, 496, 506, 511, 527, 528, 530, 534, 542
Offset: 0

Author

Christian Perfect, Mar 15 2017

Keywords

Comments

Skip the first decimal digit of Pi, and then look for the first occurrence of each of the digits in order, only moving forward.
This sequence arose as a result of the claim that the digits of Pi appear in order again later on, if you allow gaps between subsequent digits.
a(n) ~ 10n. - Robert G. Wilson v, Mar 15 2017

Examples

			a(1) = 3, because the first occurrence of the first decimal digit of Pi after the first decimal digit is at the 3rd decimal digit.
a(2) = 19, because the next occurrence of the second decimal digit of Pi after the 3rd decimal digit is at the 19th decimal digit.
		

Crossrefs

Cf. A000796.

Programs

  • Mathematica
    pid = RealDigits[Pi - 3, 10, 10000][[1]]; a[0] = 1; a[n_] := a[n] = SelectFirst[ Flatten[ Position[ pid, pid[[n]], 1, 200]], a[n -1] < # &]; Array[a, 100] (* Robert G. Wilson v, Mar 15 2017 *)

A269225 Smallest k such that k! > 2^n.

Original entry on oeis.org

2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27
Offset: 0

Author

Christian Perfect, Jul 11 2016

Keywords

Examples

			a(7) = 6 because 6! = 720 > 2^7 = 128, but 5! = 120 < 128.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{v=2^n, k=1}, While[++k! <= v]; k]; Array[a, 93, 0] (* Giovanni Resta, Jul 11 2016 *)
    Module[{nn=30,f},f=Table[{k,k!},{k,nn}];Table[SelectFirst[f,#[[2]]>2^n&],{n,0,100}]][[;;,1]] (* Harvey P. Dale, Feb 19 2024 *)
  • PARI
    a(n)=localprec(19); my(t=log(2)*n, x=ceil(solve(k=1, n/2+5, lngamma(k+1)-t))); while(x!<=2^n, x++); x \\ Charles R Greathouse IV, Jul 12 2016
  • Python
    def a269225():
       k = 1
       f = 1
       p = 1
       n = 0
       while True:
          while f<=p:
             k += 1
             f *= k
          yield k
          p *= 2
          n += 1
    

A268176 a(0) = a(1) = 1, and a(n) = a(n-1) + a( (a(n-1)-1) mod n ) for n>=2.

Original entry on oeis.org

1, 1, 2, 3, 5, 10, 13, 23, 36, 72, 73, 86, 87, 123, 196, 197, 202, 398, 399, 798, 1196, 1994, 2117, 2118, 2128, 2130, 4248, 4284, 8568, 8655, 8851, 9048, 11166, 11252, 20300, 40600, 44884, 44886, 44909, 45707, 49955, 50157, 50193, 50279, 59130, 118260, 163967
Offset: 0

Author

Christian Perfect, Jan 28 2016

Keywords

Crossrefs

Cf. A125204.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, 1,
           a(n-1)+a(irem((a(n-1)-1), n)))
        end:
    seq(a(n), n=0..50);  # Alois P. Heinz, Apr 08 2016
  • Mathematica
    a[0] = a[1] = 1; a[n_] := a[n] = # + a@ Mod[# - 1, n] &@ a[n - 1]; Array[a, 47, 0] (* Michael De Vlieger, Apr 08 2016 *)
  • PARI
    lista(nn) = {va = vector(nn); print1(va[1] = 1, ", "); print1(va[2] = 1, ", "); for (n=3, nn, va[n] = va[n-1] + va[((va[n-1]-1) % (n-1))+1]; print1(va[n], ", "););} \\ Michel Marcus, Apr 08 2016
    
  • Python
    from sympy.core.cache import cacheit
    @cacheit
    def a(n): return 1 if n<2 else a(n - 1) + a((a(n - 1) - 1)%n)
    print([a(n) for n in range(51)]) # Indranil Ghosh, Aug 06 2017

A264688 The decimal digits of n appear n times in the decimal representation of n!.

Original entry on oeis.org

0, 1, 1170, 1528, 9877, 9886, 9897, 11535
Offset: 1

Author

Christian Perfect, Jan 03 2016

Keywords

Comments

There are no more terms up to n=21000, checked using the Python program below.
a(9) > 200000. - Dana Jacobsen, Jan 03 2016

Examples

			1170 belongs to this sequence because the digits 1, 7 and 0 appear 1170 times in total in the decimal representation of 1170!.
0! = 1, which contains no zeros, so 0 is a term.
		

Programs

  • Perl
    use ntheory ":all"; sub is_a264688 { my $n = shift; $n == eval "factorial($n) =~ tr/[$n]//"; } # Dana Jacobsen, Jan 03 2016
  • Python
    from math import factorial
    def in_a(n):
        f = str(factorial(n))
        s = set(str(n))
        return sum(f.count(d) for d in s)==n
    

A263458 Deal a pack of n cards into two piles and gather them up, n/2 times. All n such that this reverses the order of the deck.

Original entry on oeis.org

4, 6, 12, 22, 28, 30, 36, 46, 52, 60, 70, 78, 100, 102, 108, 126, 148, 150, 156, 166, 172, 180, 190, 196, 198, 222, 228, 238, 262, 268, 270, 276, 292, 310, 316, 348, 358, 366, 372, 382, 388, 396, 420, 430, 438, 460, 462, 478, 486, 502, 508, 540, 556, 598
Offset: 1

Author

Christian Perfect, Oct 19 2015

Keywords

Comments

This seems to be A003628(n)-1; that is, each element of this sequence is one less than a prime congruent to 5 or 7 modulo 8.

Examples

			Take a deck of 52 playing cards. Deal it into two piles, then pick up the first pile and put it on top of the other. Do this 26 times. The order of the deck is reversed, so 52 belongs to this sequence.
6 is in the sequence because the 3 shuffles are [1, 2, 3, 4, 5, 6] -> [5, 3, 1, 6, 4, 2] -> [4, 1, 5, 2, 6, 3] -> [6, 5, 4, 3, 2, 1], original reversed. 8 is not in the sequence because the 4 shuffles are [1, 2, 3, 4, 5, 6, 7, 8] -> [7, 5, 3, 1, 8, 6, 4, 2] -> [4, 8, 3, 7, 2, 6, 1, 5] -> [1, 2, 3, 4, 5, 6, 7, 8] -> [7, 5, 3, 1, 8, 6, 4, 2], not the original reversed. - _R. J. Mathar_, Aug 02 2024
		

Crossrefs

Programs

  • Maple
    isA263458 := proc(n)
        local L,itr ;
        L := [seq(i,i=1..n)] ;
        for itr from 1 to n/2 do
            L := pileShuf(L) ; # function code in A323712
        end do:
        for i from 1 to nops(L) do
            if op(-i,L) <> i then
                return false ;
            end if;
        end do:
        true ;
    end proc:
    n := 1;
    for k from 2 do
        if isA263458(k) then
            printf("%d %d\n",n,k) ;
            n := n+1 ;
        end if;
    end do: # R. J. Mathar, Aug 02 2024
  • Sage
    from itertools import cycle
    def into_piles(r,deck):
        packs = [[] for i in range(r)]
        for card, pack in zip(range(1,deck+1),cycle(range(r))):
            packs[pack].insert(0,card)
        out = sum(packs,[])
        return Permutation(out)
    def has_reversing_property(deck):
        p = power(into_piles(2,deck), deck/2)
        return p==into_piles(1,deck)
    [i for i in range(2,400,2) if has_reversing_property(i)]

A262719 a(n) is the smallest nonnegative k such that there is no 3 X 3 matrix with entries in {1,...,n} whose determinant is k.

Original entry on oeis.org

1, 6, 21, 55, 110, 203, 357, 544, 808, 1177, 1670, 2215, 2865, 3599, 4558, 5621, 6637, 8041, 9769, 11413, 13394, 15593, 17683, 20317, 23249, 26063, 29506, 33287, 37461, 41692, 46306, 50707, 55667, 61723, 67547, 73939, 80767, 87941, 94913, 101613, 111422
Offset: 1

Author

Christian Perfect, Sep 28 2015

Keywords

Examples

			For n=1, the only matrix is the matrix of all 1s, which has determinant 0. Hence, a(1)=1.
		

Programs

  • Python
    from itertools import product, groupby, count
    def det(m):
        a, b, c, d, e, f, g, h, i = m
        return abs(a*(e*i-f*h)-b*(d*i-f*g)+c*(d*h-e*g))
    def a262719(n):
        s = list(product(range(1, n+1), repeat=9))
        i = 0
        for k, ms in groupby(sorted(s, key=det), key=det):
            if k!=i:
                return i
            i += 1
        return i

Extensions

a(7)-a(41) from Hiroaki Yamanouchi, Oct 17 2015