A sequence and a question

35 views
Skip to first unread message

Ali Sada

unread,
Mar 17, 2025, 12:04:15 PM3/17/25
to seq...@googlegroups.com


Hi everyone,

 

Hope all is well.

I would really appreciate any help finding the terms of this sequence “The least positive integer k such that k*(2n-1) contains only the digit 1 in base 4.”

Ex. 3*7 = 21, which is 111 in base 4. So, a(2) = 7 (and a(4) = 3.)


Is this statement correct "For every positive integer n, there is an infinite number of multiples of n that contain only the digit 1 in base k, where k<n and n and k are coprime."?

 

Best,

 

Ali


Kevin Ryde

unread,
Mar 17, 2025, 7:43:22 PM3/17/25
to seq...@googlegroups.com
Ali Sada <ali....@gmail.com> writes:
>
> “The least positive integer k such that k*(2n-1) contains only the
> digit 1 in base 4.”

Repdigits like that become a power so in this case

(4^x-1)/3 = k*(2n-1)
(4^x-1)/3 == 0 mod 2n-1
so
4^x == 1 mod 3*(2*n-1)
which is x = A216829(n)
and k = (4^x-1)/(3*(2*n-1))

M F Hasler

unread,
Mar 17, 2025, 8:44:51 PM3/17/25
to seq...@googlegroups.com
On Mon, Mar 17, 2025, 12:04 Ali Sada <ali....@gmail.com> wrote:

I would really appreciate any help finding the terms of this sequence “The least positive integer k such that k*(2n-1) contains only the digit 1 in base 4.”

Ex. 3*7 = 21, which is 111 in base 4. So, a(2) = 7 (and a(4) = 3.)


The repunits (numbers with only digit 1) are R(n) = (b^n-1)/(b-1) in base b.
So you are looking for k, m such that
k(2n-1) = R(m) 
<=> (b-1) k (2n-1) = b^m-1  
<=> 3 k (2n-1) + 1 = 4^m  for  b=4
This can also be written as :  4^m == 1 (mod 3(2n-1))
The smallest such m > 1 is called the multiplicative order of 4 (mod 3(2n-1)).
[That is, one considers the group of invertible elements in the ring  Z / qZ with q = 3(2n-1).
It is known that the invertible elements in Z/qZ are those relatively prime to q, which is odd (here), so 4 is indeed invertible.
It is easy to see that in a finite group, any element x has a finite order g such that x^g becomes the unit element.]

So, there is indeed such an m for any n, and the k-value follows as  k = R(m)/(2n-1).
This works also for other bases b whenever b is coprime to (b-1)(2n-1), 
which is equivalent to gcd( b, 2n-1 ) = 1, since always gcd(b, b-1) = 1.

Is this statement correct "For every positive integer n, there is an infinite number of multiples of n that contain only the digit 1 in base k, where k<n and n and k are coprime."?

In this phrase, you changed the meaning of all the variables used earlier ! :-D

Let's re-state: for any number  n  that is coprime to the base  b (= k if you wish)
there is  m  such that the base  b  repunit of length  m,  
R(m) = (b^m-1)/(b-1) ,  is a multiple of n.  (Your earlier k was the ratio R(m)/n...)

The question is, do we have always infinitely many  m-values?
Indeed, yes: in the above we have chosen m as the multiplicative order, 
which is the smallest m > 1 that satisfies the congruence.
But any multiple of this m will also satisfy the congruence:
if  x^m = 1 (mod q),  then  x^(m*r) = (x^m)^r = 1^r = 1 (mod q).

If the (base b) repunit of length m is the smallest one to be a multiple of  q = (b-1)n,
then all (base b) repunits  R(r*m)  of length r*m, r >= 1, are again a multiple of q. 

For example, after (4^6-1)/3 = 1365  which is a multiple of 7,
you have again  (4^12-1)/3 = 5592405 which is a multiple of 7,
and similar for 4^18, 4^24, etc.

In PARI/GP, you can use  
m(n,b) = znorder( Mod(b, (b-1)*n)) 
to get the smallest m-value that yields a base b repunit  R(m) = (b^m-1)/(b-1)  which is a multiple of n.

Then,  [m(2*n-1,4) | n <- [1..50]]  gives indeed A216829, as Kevin wrote.
and your initial sequence a(n) would be
[ 4^m(2*n-1,4)\3/(2*n-1) | n <- [1..50]]
%2 = [1, 7, 1, 3, 9709, 31, 105, 91, 5, 4599, 1, 60787, 13981, 222399981598543, 3085465, 11, 10845877, 39, 619094385, 35, 8525, 127, 509033161, 499069107643, 29918683749, 109655, 28324525958305, 6355, 1533, 1628420204246959, 6300117511512825, 1387, 21, 367099384551433863, 356458822680377809, 5542683665339959171, 1197, 5124095576030431, ...]

(To produce the repunits for a base b>2 you don't need to subtract 1:
you can simply use the "floor division",  b^m \ (b-1)  in PARI/GP, or  b**m // (b-1)  in Python.)

- Maximilian 

Ali Sada

unread,
Mar 17, 2025, 10:26:44 PM3/17/25
to seq...@googlegroups.com
Thank you, Kevin and Maximlian for your response. Is the sequence OEIS-worthy? I would love to see its scatterplot.

Best,

Ali

--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/seqfan/CAFqvfd8XBj1G5q8u-x8y1fkJE8cMouZz8w2gnCtgZMDHtZdA8A%40mail.gmail.com.

Joerg Arndt

unread,
Mar 22, 2025, 11:20:07 AM3/22/25
to seq...@googlegroups.com
Here is a little known fact that might be useful:
One can plot a sequence without entering it in the OEIS first.

Best regards, jj
>> <https://oeis.org/A216829>, as Kevin wrote.
>> and your initial sequence a(n) would be
>> [ 4^m(2*n-1,4)\3/(2*n-1) | n <- [1..50]]
>> %2 = [1, 7, 1, 3, 9709, 31, 105, 91, 5, 4599, 1, 60787, 13981,
>> 222399981598543, 3085465, 11, 10845877, 39, 619094385, 35, 8525, 127,
>> 509033161, 499069107643, 29918683749, 109655, 28324525958305, 6355, 1533,
>> 1628420204246959, 6300117511512825, 1387, 21, 367099384551433863,
>> 356458822680377809, 5542683665339959171, 1197, 5124095576030431, ...]
>>
>> (To produce the repunits for a base b>2 you don't need to subtract 1:
>> you can simply use the "floor division", b^m \ (b-1) in PARI/GP, or
>> b**m // (b-1) in Python.)
>>
>> - Maximilian
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "SeqFan" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to seqfan+un...@googlegroups.com.
>> To view this discussion visit
>> https://groups.google.com/d/msgid/seqfan/CAFqvfd8XBj1G5q8u-x8y1fkJE8cMouZz8w2gnCtgZMDHtZdA8A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/seqfan/CAFqvfd8XBj1G5q8u-x8y1fkJE8cMouZz8w2gnCtgZMDHtZdA8A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

Ali Sada

unread,
Mar 22, 2025, 1:45:33 PM3/22/25
to seq...@googlegroups.com

Marc LeBrun

unread,
Mar 22, 2025, 2:24:36 PM3/22/25
to seq...@googlegroups.com
Adi, I think Joerg is suggesting that you could take more initiative to help yourself rather than asking seqfans to do all your work for you.

For instance you might consider asking one of the many available Chatbots.  As an example I asked Perplexity

"What is the easiest way one can plot a sequence of integer values?  We are potentially interested in looking at pin plots and scatter plots of both the actual values and their logs."

And it gave me detailed step-by-step instructions for using Python's Matplotlib library to do so.  

Then as a follow-on question I asked it

"What if we would like to make these plots without writing a program?"

And it responded with detailed step-by-step instructions for using the free Desmos graphing calculator from your browser.

I am sure you could also get started with similarly helpful guidance from GPT, Claude or any of the many other choices available nowadays.

If you would like I would be happy to email transcripts of the above responses directly to you rather than monopolize the attention of this audience further.

Best regards,  --MLB


Ali Sada

unread,
Mar 22, 2025, 3:35:13 PM3/22/25
to seq...@googlegroups.com
Thank you Marc for your insightful email. I really appreciate it. The main point of that short email was "Is the sequence OEIS-worthy?"  Just trying to save the editors some time.  I don't think I can google an answer to that question.
The note about the plot was simply another way of saying, "I think the sequence has an interesting plot," which is a common practice in the English language. I wasn't asking anyone to plot it for me.

(Side note: I don't think AI is at the level where it can answer math questions correctly. I tried.)

Best,

Ali

Daniel Mondot

unread,
Mar 22, 2025, 7:33:35 PM3/22/25
to seq...@googlegroups.com
I just added a substantial b-file to A089087.

I expect the graph to be interesting... (just the look of the b-file is interesting)

Daniel
Reply all
Reply to author
Forward
0 new messages