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.

A181373 Least m>0 such that prime(n) divides S(m)=A007908(m)=123...m and all numbers obtained by cyclic permutations of its digits; 0 if no such m exists.

This page as a plain text file.
%I A181373 #31 Oct 08 2023 04:43:19
%S A181373 0,2,0,100,106,120,196,102,542,400,181,21,216,372,10446,127,10086,616,
%T A181373 399,1703,196,2009,118,12350,516,416,13244,884,15462,15146,106,
%U A181373 1006942,10762,10814,11634,5808,12408,576,30076,4996,25290,1015092,1108,26874,24036,5994
%N A181373 Least m>0 such that prime(n) divides S(m)=A007908(m)=123...m and all numbers obtained by cyclic permutations of its digits; 0 if no such m exists.
%C A181373 The first three primes 2, 3 and 5 are particular cases, cf. examples. It happens that all other primes < 47 are in A180346 (and therefore have a(n) < 1000). P=37 is the only one among them with a(n) < 100 (but m=123 is another possibility for this prime).
%C A181373 Conjecture: a(n) > 0 for n <> 1 and n <> 3. - _Chai Wah Wu_, Oct 06 2023
%C A181373 Least m>0 such that prime(n) divides both A007908(m) and 10^A058183(m)-1; or 0 if no such m exists. - _Chai Wah Wu_, Oct 07 2023
%H A181373 Chai Wah Wu, <a href="/A181373/b181373.txt">Table of n, a(n) for n = 1..4042</a>
%F A181373 A007908( A181373(n) ) = 0 (mod A000040(n)).
%e A181373 For prime(1)=2, no such m can exist (consider e.g. the initial 1 is permuted to the end), therefore a(1)=0.
%e A181373 For prime(2)=3, we have S(2)=12 and the permutation 21 both divisible by 3, thus a(2)=2. (There are many m for which the divisibility property is satisfied; it is equivalent to 1+...+m=0 (mod 3), or equivalently the sum of all these digits is divisible by 3. Therefore, the permutations do not need to be checked.)
%e A181373 For prime(3)=5, similar to prime(1)=2, no such m can exist.
%e A181373 For prime(4)=7, it turns out the m=100 is the least possibility, i.e., 123...99100 and the permutations 234...991001, 345...9910012, ... 100123...99, (00)123...991, (0)123...9910 are all divisible by 7.
%o A181373 (PARI) A181373(p,LIM=999,MIN=1)={ p=prime(p); p!=2 & p!=5 & for(n=MIN,LIM, my(S=eval(concat(vector(n,i,Str(i)))),L=#Str(S)-1); S%p & next; for(k=1,L, (S=[1,10^L]*divrem(S,10)) % p & next(2)); return(n)) } /* highly unoptimized code, for illustration purpose */
%o A181373 (Python)
%o A181373 from sympy import prime
%o A181373 def A181373(n):
%o A181373     s, p, l = '', prime(n), 0
%o A181373     for m in range(1,10**6):
%o A181373         u = str(m)
%o A181373         s += u
%o A181373         l += len(u)
%o A181373         t = s
%o A181373         if not int(t) % p:
%o A181373             for i in range(l-1):
%o A181373                 t = t[1:]+t[0]
%o A181373                 if int(t) % p:
%o A181373                     break
%o A181373             else:
%o A181373                 return m
%o A181373     else:
%o A181373         return 'search limit reached.' # _Chai Wah Wu_, Nov 12 2015
%o A181373 (Python)
%o A181373 from itertools import count
%o A181373 from sympy import prime
%o A181373 def A181373(n):
%o A181373     if n == 1 or n == 3: return 0
%o A181373     p, c, q, a, b = prime(n), 0, 1, 10, 10
%o A181373     for m in count(1):
%o A181373         if m >= b:
%o A181373             a = 10*a%p
%o A181373             b *= 10
%o A181373         c = (c*a + m) % p
%o A181373         q = q*a % p
%o A181373         if not (c or (q-1)%p):
%o A181373             return m # _Chai Wah Wu_, Oct 07 2023
%Y A181373 Cf. A000040, A007908, A058183, A180346 (see references there), A181373.
%K A181373 nonn,base
%O A181373 1,2
%A A181373 _M. F. Hasler_ and _Marco RipĂ _, Jan 27 2011
%E A181373 a(15)-a(31) from _Chai Wah Wu_, Nov 12 2015
%E A181373 a(32)-a(46) from _Chai Wah Wu_, Oct 06 2023