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: Dimiter Skordev

Dimiter Skordev's wiki page.

Dimiter Skordev has authored 4 sequences.

A348209 a(n) is the smallest positive integer k such that the base-n representation of 2^k has a pandigital ending of length n, or 0 if no such k exists.

Original entry on oeis.org

1, 5, 0, 34, 33, 20, 0, 1689, 7386, 1971, 34180, 43983, 262717, 37576, 0, 617963, 2818633, 2136492, 5325278, 140997161, 572340185, 1140209730, 800810806, 5573697257, 6694155083, 15533636306, 220798644390
Offset: 2

Author

Dimiter Skordev, Oct 07 2021

Comments

The base-n representations under consideration are assumed to be without leading zeros. A base-n pandigital string is any string of base-n digits that contains all of them (strings beginning with 0 are admitted).
The base-n representation of a positive integer x has an ending of length n iff x >= n^(n-1). The base-n representations of two such integers have the same ending of length n iff these numbers are congruent modulo n^n.
a(n) = 0 whenever n is a power of 2 other than 2 itself. This is because powers of 2 in power-of-2 bases can have only two distinct digits. Is a(n) equal to 0 for any other values of n?
Let n be a positive integer that is not a power of 2. Then n = (2^u)*v, where u is a nonnegative integer, and v is an odd number greater than 1. Let d be the multiplicative order of 2 modulo v^n (of course, d <= phi(v^n) where phi is Euler's totient function). Suppose k is an integer such that 2^k >= n^(n-1). Then the base-n representation of 2^(k+d) has the same ending of length n as the base-n representation of 2^k. This can be shown by proving that 2^(k+d) and 2^k are congruent modulo n^n. One may reason as follows. Since 2^(k+d) - 2^k = 2^k*(2^d - 1), n^n = 2^(u*n)*v^n, and the number 2^d - 1 is divisible by v^n, it is sufficient to prove that k >= u*n. This inequality holds indeed because 2^k/2^(u*n) >= n^(n-1)/(2^u)^n = v^n/n > 1.
Suppose now there is a positive integer k such that the base-n representation of 2^k for the considered n has a pandigital ending of length n. The least such integer is a(n), and, by the statement proved above, the inequality 2^k < n^(n-1)*2^d holds for this k (otherwise the base-n representation of 2^(k-d) would have the same ending of length n as the one of 2^k). Thus a(n) is an algorithmically computable function of n. (Unfortunately, due to enormous values of d, the algorithm derived from the above reasoning seems to be of no practical use for the actual computation of a(n) in the possibly existing cases when n is not a power of 2, but the base-n representation of no power of 2 has a pandigital ending with length n.)
a(n) > 0 for all integers n between 2 and 200 that are not powers of 2, with the possible exception of the numbers 80, 96, 112, 144, 160, 168, 176, 184 and 192. For those of the above-mentioned integers n with a(n) > 0 that are greater than 28, corresponding numbers k are presented such that the base-n representation of 2^k has a pandigital ending with length n. These k were found by appropriately using Euler's totient theorem, and they can be seen in an uploaded file.

Examples

			a(5) = 34 because the base-5 representation of 2^34 is 240141021303214 and thus has the ending 03214, whereas none of the base-5 representations of the previous powers of 2 ends with a pandigital string of length 5.
		

Crossrefs

Programs

  • Python
    from labmath import multord
    def w(r,n):
        z,s=r,set()
        while z%n not in s:
            s.add(z%n)
            z=z//n
        return len(s)
    def a(n):
        if n==2: return 1
        else:
            v=n
            while v%2==0: v=v//2
            if v==1: return 0
            else:
                k,r,m=0,1,n**(n-1)
                while r
    				
  • Python
    from itertools import count
    from sympy.ntheory import digits
    def A348209(n):
        if n == 2: return 1
        if n.bit_count() == 1: return 0
        r = (a:=n**n).bit_length()
        m = pow(2,r,a)
        for k in count(r):
            if len(set((s:=digits(m,n)[1:])+([0] if len(s)Chai Wah Wu, Aug 22 2025

Extensions

a(28) from Chai Wah Wu, Dec 13 2021

A348516 a(n) is the least positive integer k such that the base 3 representation of n^k contains equally many 1's and 2's, or 0 if no k with this property exists.

Original entry on oeis.org

1, 0, 7, 0, 16, 1, 7, 1, 22, 0, 16, 1, 16, 6, 2, 1, 8, 6, 7, 1, 4, 1, 66, 9, 22, 3, 2, 0, 15, 1, 16, 2, 32, 1, 6, 9, 16, 2, 11, 6, 19, 13, 2, 13, 1, 1, 10, 22, 8, 2, 1, 6, 1, 159, 7, 1, 20, 1, 3, 6, 4, 2, 15, 1, 11, 3, 66, 6, 1, 9, 1, 6, 22, 2, 4, 3, 1, 2, 2, 2, 6
Offset: 0

Author

Dimiter Skordev, Oct 21 2021

Keywords

Comments

a(3*n) = a(n) for any positive integer n because multiplication by 3 does not change the counts of the digits 1 and 2 in the base 3 representation. Hence a(n) reaches any of its values at infinitely many n.
There are infinitely many n with a(n) = 1 that are not divisible by 3, e.g. the numbers of the form (3^m + 2)(3^(m-1) + 3^(m-2) + ... + 3 + 1), m = 1, 2, 3, ...
Of course, a(n^a(n)) = 1 whenever a(n) > 0. More generally, if a(n) = p*q, where p and q are positive integers, then a(n^p) = q (hence any positive divisor of a nonzero term of the sequence is a term too). If a(n) = 0 then a(n^p) = 0 for any positive integer p.
In the absence of a proof that a(n) = 0 only for the numbers n which are powers of 3, it would be desirable to have at least an algorithm whose application to any concrete n answers the question whether a(n) = 0.
Except for the case when the number a(n) is 0, it is the least positive integer k such that n^k is a term of the sequence A039001.
Problem: Are there positive integers not occurring in the sequence a(1),a(2),a(3),...?

Examples

			a(2) = 7 because the base 3 representations of 2^1, 2^2, 2^3, 2^4, 2^5, 2^6 and 2^7 are 2, 11, 22, 121, 1012, 2101 and 11202 respectively.
		

Crossrefs

Cf. A039001.

Programs

  • Mathematica
    Array[If[IntegerQ@ Log[3, #], 0, Block[{k = 1}, While[Unequal @@ Most@ DigitCount[#^k, 3], k++]; k]] &, 72] (* Michael De Vlieger, Oct 21 2021 *)
  • PARI
    isp3(n) = my(q); isprimepower(n,&q) && (q==3);
    isok(k, n) = my(d=digits(n^k, 3)); #select(x->(x==1), d) == #select(x->(x==2), d);
    a(n) = if ((n==1) || isp3(n), return (0)); my(k=1); while (!isok(k, n), k++); k; \\ Michel Marcus, Oct 22 2021
  • Python
    h=[0,1,-1]
    def d(x):
        y,d=x,0
        while y>0: d,y=d+h[y%3],y//3
        return d
    def a(n):
        v,a,x=n,0,1
        while v%3==0: v=v//3
        if v>1:
            while d(x)!=0: a,x=a+1,v*x
        return a
    
  • Python
    from gmpy2 import digits
    def A348516(n):
        k, s = 1, digits(n,3).rstrip('0')
        if s == '1' or s == '': return 1-len(s)
        m = int(s,3)
        mk = m
        while s.count('1') != s.count('2'): k += 1; mk *= m; s = digits(mk,3)
        return k # Chai Wah Wu, Nov 11 2021
    

Extensions

a(0) from Michel Marcus, Nov 11 2021

A347164 Positive integers k such that the decimal representation of 2^k ends with some permutation of the string "0123456789".

Original entry on oeis.org

7386, 11061, 15176, 16054, 19950, 24493, 26749, 29160, 33902, 42207, 43013, 44233, 45627, 52235, 54727, 56186, 59228, 59229, 59230, 60883, 62823, 63468, 65404, 69960, 71225, 71804, 75176, 78392, 89416, 96576, 96682, 97723, 98085, 98561, 102735, 104125, 105301, 105760
Offset: 1

Author

Dimiter Skordev, Aug 20 2021

Keywords

Comments

If k is a term of the sequence then some nonzero digit must occur more than once in the decimal representation of 2^k because 1+2+3+4+5+6+7+8+9=45, and 2^k is not divisible by 9. Thus 2^k>10^10 and therefore k>33 for any term k.
A positive integer k is a term of the sequence iff a decimal representation of the remainder of 2^k modulo 10^10 (possibly containing a leading zero) is a permutation of the string "0123456789".
Let d = 7812500 = 4*5^9 = phi(5^10) where phi is Euler's totient function. The remainders of the powers of 2 modulo 10^10 form an eventually periodic sequence with period d: if k >= 10 then 2^(k+d) - 2^k is divisible by 10^10 since 2^(k+d) - 2^k = 2^k*(2^d-1) and 10^10 = 2^10*5^10. Hence if k >= 10 then k + d is a term iff k is a term.
Actually the above equivalence holds for all positive integers k because neither k nor k + d is a term of the sequence for k < 10 (the decimal representations of the numbers 2^(k + d) with k = 1, 2, ..., 9 end, respectively, with the following strings: 3574218752, 7148437504, 4296875008, 8593750016, 7187500032, 4375000064, 8750000128, 7500000256, 5000000512).
There are 2795 terms not exceeding d. The last of them is 7808304, with decimal representation of the corresponding power of 2 ending with 9745238016.

Examples

			7386, 11061 and 15176 are in the sequence because the decimal representations of the corresponding powers of 2 end with 9815307264, 4706813952 and 0294875136, respectively.
		

Crossrefs

Cf. A090493, A291926. Subsequence of A130694.

Programs

  • Maple
    q:= n-> (l-> is({l[], `if`(nops(l)<10, 0, [][])}=
        {$0..9}))(convert(2&^n mod 10^10, base, 10)):
    select(q, [$1..120000])[];  # Alois P. Heinz, Aug 23 2021
  • Mathematica
    Select[Range[10^5],Union[If[Length[s=IntegerDigits@PowerMod[2,#,10^10]]==9,Join[{0},s],s]]==0~Range~9&] (* Giorgos Kalogeropoulos, Sep 03 2021 *)
  • PARI
    isok(k) = my(d=digits(lift(Mod(2, 10^10)^k))); if (#d<10, d = concat(d, 0)); #Set(d) == 10; \\ Michel Marcus, Oct 01 2021
  • Python
    k,r,n=1,2,1
    while n<=6000:
        s,t=set(),r
        for i in range(10):
            s.add(t%10)
            t=t//10
        if len(s)==10:
            print(n,k)
            n=n+1
        k,r=k+1,2*r%10**10
    

Formula

a(n+c) = a(n) + d with c=2795 and d as above.

A331841 When expressed in base 2 and then interpreted in base 5, is a multiple of the original number.

Original entry on oeis.org

0, 1, 3, 6, 9, 10, 18, 21, 27, 30, 54, 57, 60, 63, 89, 90, 108, 114, 126, 130, 178, 180, 189, 228, 300, 356, 378, 390, 630, 712, 780, 900, 1170, 1299, 1300, 1890, 1953, 2340, 2370, 2730, 3510, 3900, 3906, 4740, 7020, 7110, 7410, 7800, 8100, 8190, 9261, 11700
Offset: 1

Author

Dimiter Skordev, Jan 29 2020

Keywords

Examples

			30 = 11110_2; 11110_5 = 780 = 26*30.
		

Crossrefs

Cf. (with base 2 and b): A062845 (b=3), A062846 (b=4), A062847 (b=6), A062848 (b=7), A062849 (b=8), A062850 (b=9), A032533 (b=10).

Programs

  • Magma
    [0] cat [k:k in [1..12000]|Seqint(Intseq(Seqint(Intseq(k, 2))), 5) mod k eq 0]; // Marius A. Burtea, Jan 29 2020
  • Mathematica
    Prepend[Select[Range[12000], Divisible[FromDigits[IntegerDigits[#, 2], 5], #] &], 0] (* Amiram Eldar, Jan 29 2020 *)
  • PARI
    isok(n) = (n == 0) || (fromdigits(digits(n, 2), 5) % n) == 0; \\ Michel Marcus, Jan 29 2020