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.

Showing 1-10 of 103 results. Next

A153446 Terms in A046034 which are pairwise products of terms in A046034.

Original entry on oeis.org

25, 35, 75, 225, 275, 375, 525, 575, 2275, 2325, 2555, 2775, 3775, 5575, 5775, 7575, 7725, 7755, 22575, 22725, 23275, 23325, 23725, 25275, 25375, 25575, 25725, 27335, 27375, 27775, 32775, 37275, 37775, 52325, 53325, 55225, 55275, 55575, 57375
Offset: 1

Views

Author

Zak Seidov, Dec 26 2008

Keywords

Comments

All terms are = 5 (mod 10).

Examples

			25 = 5*5 = A046034(3)*A046034(3) = A046034(7);
35 = 5*7 = A046034(3)*A046034(4) = A046034(11);
75 = 3*25 = A046034(2)*A046034(7) = A046034(19);
225 = 3*75 = A046034(2)*A046034(19) = A046034(23);
275 = 5*55 = A046034(3)*A046034(15) = A046034(35).
		

Crossrefs

Cf. A046034 (numbers with prime digits).

Programs

  • Mathematica
    Select[Flatten@ Table[FromDigits /@ Tuples[{2, 3, 5, 7}, n], {n, 5}], Function[k, Total@ Map[Times @@ # &, Boole@ Map[Total@ Pick[DigitCount@ #, {1, 0, 0, 1, 0, 1, 0, 1, 1, 1}, 1] == 0 &, Transpose@ {#, k/#} &@ Rest@ Take[#, Ceiling[Length[#]/2]] &@ Divisors@ k, {2}]] > 0]] (* Michael De Vlieger, Sep 19 2016 *)
    id[n_]:=IntegerDigits[n]; pQ[n_]:=AllTrue[id[n],PrimeQ];
    nQ[n_]:=Select[Times@@@Tuples[Select[Divisors[n],AllTrue[id[#],PrimeQ]&],2],#==n&]
    !={};
    Select[Flatten@Table[FromDigits/@Tuples[{2,3,5,7},n],{n,5}],pQ[#]&&nQ[#]&] (* Ivan N. Ianakiev, Jul 20 2022 *)

A055642 Number of digits in the decimal expansion of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
Offset: 0

Views

Author

Henry Bottomley, Jun 06 2000

Keywords

Comments

From Hieronymus Fischer, Jun 08 2012: (Start)
For n > 0 the first differences of A117804.
The total number of digits necessary to write down all the numbers 0, 1, 2, ..., n is A117804(n+1). (End)
Here a(0) = 1, but a different common convention is to consider that the expansion of 0 in any base b > 0 has 0 terms and digits. - M. F. Hasler, Dec 07 2018

Examples

			Examples:
999: 1 + floor(log_10(999)) = 1 + floor(2.x) = 1 + 2 = 3 or
      ceiling(log_10(999+1)) = ceiling(log_10(1000)) = ceiling(3) = 3;
1000: 1 + floor(log_10(1000)) = 1 + floor(3) = 1 + 3 = 4 or
      ceiling(log_10(1000+1)) = ceiling(log_10(1001)) = ceiling(3.x) = 4;
1001: 1 + floor(log_10(1001)) = 1 + floor(3.x) = 1 + 3 = 4 or
      ceiling(log_10(1001+1)) = ceiling(log_10(1002)) = ceiling(3.x) = 4;
		

Crossrefs

Programs

  • Haskell
    a055642 :: Integer -> Int
    a055642 = length . show  -- Reinhard Zumkeller, Feb 19 2012, Apr 26 2011
    
  • Magma
    [ #Intseq(n): n in [0..105] ];   //  Bruno Berselli, Jun 30 2011
    (Common Lisp) (defun A055642 (n) (if (zerop n) 1 (floor (log n 10)))) ; James Spahlinger, Oct 13 2012
    
  • Maple
    A055642 := proc(n)
            max(1,ilog10(n)+1) ;
    end proc:  # R. J. Mathar, Nov 30 2011
  • Mathematica
    Join[{1}, Array[ Floor[ Log[10, 10# ]] &, 104]] (* Robert G. Wilson v, Jan 04 2006 *)
    Join[{1},Table[IntegerLength[n],{n,104}]]
    IntegerLength[Range[0,120]] (* Harvey P. Dale, Jul 02 2016 *)
  • PARI
    a(n)=#Str(n) \\ M. F. Hasler, Nov 17 2008
    
  • PARI
    A055642(n)=logint(n+!n,10)+1 \\ Increasingly faster than the above, for larger n. (About twice as fast for n ~ 10^7.) - M. F. Hasler, Dec 07 2018
    
  • Python
    def a(n): return len(str(n))
    print([a(n) for n in range(121)]) # Michael S. Branicky, May 10 2022
    
  • Python
    def A055642(n): # Faster than len(str(n)) from ~ 50 digits on
        L = math.log10(n or 1)
        if L.is_integer() and 10**int(L)>n: return int(L or 1)
        return int(L)+1  # M. F. Hasler, Apr 08 2024

Formula

a(A046760(n)) < A050252(A046760(n)); a(A046759(n)) > A050252(A046759(n)). - Reinhard Zumkeller, Jun 21 2011
a(n) = A196563(n) + A196564(n).
a(n) = 1 + floor(log_10(n)) = 1 + A004216(n) = ceiling(log_10(n+1)) = A004218(n+1), if n >= 1. - Daniel Forgues, Mar 27 2014
a(A046758(n)) = A050252(A046758(n)). - Reinhard Zumkeller, Jun 21 2011
a(n) = A117804(n+1) - A117804(n), n > 0. - Hieronymus Fischer, Jun 08 2012
G.f.: g(x) = 1 + (1/(1-x))*Sum_{j>=0} x^(10^j). - Hieronymus Fischer, Jun 08 2012
a(n) = A262190(n) for n < 100; a(A262198(n)) != A262190(A262198(n)). - Reinhard Zumkeller, Sep 14 2015

A052382 Numbers without 0 in the decimal expansion, colloquial 'zeroless numbers'.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99, 111, 112, 113
Offset: 1

Views

Author

Henry Bottomley, Mar 13 2000

Keywords

Comments

The entries 1 to 79 match the corresponding subsequence of A043095, but then 81, 91-98, 100, 102, etc. are only in one of the two sequences. - R. J. Mathar, Oct 13 2008
Complement of A011540; A168046(a(n)) = 1; A054054(a(n)) > 0; A007602, A038186, A038618, A052041, A052043, and A052045 are subsequences. - Reinhard Zumkeller, Apr 25 2012, Apr 07 2011, Dec 01 2009
a(n) = n written in base 9 where zeros are not allowed but nines are. The nine distinct digits used are 1, 2, 3, ..., 9 instead of 0, 1, 2, ..., 8. To obtain this sequence from the "canonical" base 9 sequence with zeros allowed, just replace any 0 with a 9 and then subtract one from the group of digits situated on the left. For example, 9^3 = 729 (10) (in base 10) = 1000 (9) (in base 9) = 889 (9-{0}) (in base 9 without zeros) because 100 (9) = [9-1]9 = 89 (9-{0}) and thus 1000 (9) = [89-1]9 = 889 (9-{0}). - Robin Garcia, Jan 15 2014
From Hieronymus Fischer, May 28 2014: (Start)
Inversion: Given a term m, the index n such that a(n) = m can be calculated by A052382_inverse(m) = m - sum_{1<=j<=k} floor(m/10^j)*9^(j-1), where k := floor(log_10(m)) [see Prog section for an implementation in Smalltalk].
Example 1: A052382_inverse(137) = 137 - (floor(137/10) + floor(137/100)*9) = 137 - (13*1 + 1*9) = 137 - 22 = 115.
Example 2: A052382_inverse(4321) = 4321 - (floor(4321/10) + floor(4321/100)*9 + floor(4321/1000)*81) = 4321 - (432*1 + 43*9 + 4*81) = 4321 - (432 + 387 + 324) = 3178. (End)
The sum of the reciprocals of these numbers from a(1)=1 to infinity, called the Kempner series, is convergent towards a limit: 23.103447... whose decimal expansion is in A082839. - Bernard Schott, Feb 23 2019
Integer n > 0 is encoded using bijective base-9 numeration, see Wikipedia link below. - Alois P. Heinz, Feb 16 2020

Examples

			For k >= 0, a(10^k) = (1, 11, 121, 1331, 14641, 162151, 1783661, 19731371, ...) = A325203(k). - _Hieronymus Fischer_, May 30 2012 and Jun 06 2012; edited by _M. F. Hasler_, Jan 13 2020
		

References

  • Paul Halmos, "Problems for Mathematicians, Young and Old", Dolciani Mathematical Expositions, 1991, p. 258.

Crossrefs

Cf. A004719, A052040, different from A067251.
Column k=9 of A214676.
Cf. A011540 (complement), A043489, A054054, A168046.
Cf. A052383 (without 1), A052404 (without 2), A052405 (without 3), A052406 (without 4), A052413 (without 5), A052414 (without 6), A052419 (without 7), A052421 (without 8), A007095 (without 9).
Zeroless numbers in some other bases <= 10: A000042 (base 2), A032924 (base 3), A023705 (base 4), A248910 (base 6), A255805 (base 8), A255808 (base 9).
Cf. A082839 (sum of reciprocals).
Cf. A038618 (subset of primes)

Programs

  • Haskell
    a052382 n = a052382_list !! (n-1)
    a052382_list = iterate f 1 where
    f x = 1 + if r < 9 then x else 10 * f x' where (x', r) = divMod x 10
    -- Reinhard Zumkeller, Mar 08 2015, Apr 07 2011
    
  • Magma
    [ n: n in [1..114] | not 0 in Intseq(n) ]; // Bruno Berselli, May 28 2011
    
  • Maple
    a:= proc(n) local d, l, m; m:= n; l:= NULL;
          while m>0 do d:= irem(m, 9, 'm');
            if d=0 then d:=9; m:= m-1 fi;
            l:= d, l
          od; parse(cat(l))
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Jan 11 2015
    is_zeroless := n -> not is(0 in convert(n, base, 10)):
    select(is_zeroless, [seq(1..113)]);  # Peter Luschny, Jun 20 2025
  • Mathematica
    A052382 = Select[Range[100], DigitCount[#, 10, 0] == 0 &] (* Alonso del Arte, Mar 10 2011 *)
  • PARI
    select( {is_A052382(n)=n&&vecmin(digits(n))}, [0..111]) \\ actually: is_A052382 = (bool) A054054. - M. F. Hasler, Jan 23 2013, edited Jan 13 2020
    
  • PARI
    a(n) = for (w=0, oo, if (n >= 9^w, n -= 9^w, return ((10^w-1)/9 + fromdigits(digits(n, 9))))) \\ Rémy Sigrist, Jul 26 2017
    
  • PARI
    apply( {A052382(n,L=logint(n,9))=fromdigits(digits(n-9^L>>3,9))+10^L\9}, [1..100])
    next_A052382(n, d=digits(n+=1))={for(i=1, #d, d[i]|| return(n-n%(d=10^(#d-i+1))+d\9)); n} \\ least a(k) > n. Used in A038618.
    ( {A052382_vec(n,M=1)=M--;vector(n, i, M=next_A052382(M))} )(99) \\ n terms >= M
    \\ See OEIS Wiki page (cf. LINKS) for more programs. - M. F. Hasler, Jan 11 2020
    
  • Python
    A052382 = [n for n in range(1,10**5) if not str(n).count('0')]
    # Chai Wah Wu, Aug 26 2014
    
  • Python
    from sympy import integer_log
    def A052382(n):
        m = integer_log(k:=(n<<3)+1,9)[0]
        return sum((1+(k-9**m)//(9**j<<3)%9)*10**j for j in range(m)) # Chai Wah Wu, Jun 27 2025
  • Smalltalk
    A052382
    "Answers the n-th term of A052382, where n is the receiver."
    ^self zerofree: 10
    A052382_inverse
    "Answers that index n which satisfy A052382(n) = m, where m is the receiver.”
    ^self zerofree_inverse: 10
    zerofree: base
    "Answers the n-th zerofree number in base base, where n is the receiver. Valid for base > 2.
    Usage: n zerofree: b [b = 10 for this sequence]
    Answer: a(n)"
    | n m s c bi ci d |
    n := self.
    c := base - 1.
    m := (base - 2) * n + 1 integerFloorLog: c.
    d := n - (((c raisedToInteger: m) - 1)//(base - 2)).
    bi := 1.
    ci := 1.
    s := 0.
    1 to: m
    do:
    [:i |
    s := (d // ci \\ c + 1) * bi + s.
    bi := base * bi.
    ci := c * ci].
    ^s
    zerofree_inverse: base
    "Answers the index n such that the n-th zerofree number in base base is = m, where m is the receiver. Valid for base > 2.
    Usage: m zerofree_inverse: b [b = 10 for this sequence]
    Answer: n"
    | m p q s |
    m := self.
    s := 0.
    p := base.
    q := 1.
    [p < m] whileTrue:
    [s := m // p * q + s.
    p := base * p.
    q := (base - 1) * q].
    ^m - s
    "by Hieronymus Fischer, May 28 2014"
    
  • sh
    seq 0 1000 | grep -v 0; # Joerg Arndt, May 29 2011
    

Formula

a(n+1) = f(a(n)) with f(x) = 1 + if x mod 10 < 9 then x else 10*f([x/10]). - Reinhard Zumkeller, Nov 15 2009
From Hieronymus Fischer, Apr 30, May 30, Jun 08 2012, Feb 17 2019: (Start)
a(n) = Sum_{j=0..m-1} (1 + b(j) mod 9)*10^j, where m = floor(log_9(8*n + 1)), b(j) = floor((8*n + 1 - 9^m)/(8*9^j)).
Also: a(n) = Sum_{j=0..m-1} (1 + A010878(b(j)))*10^j.
a(9*n + k) = 10*a(n) + k, k=1..9.
Special values:
a(k*(9^n - 1)/8) = k*(10^n - 1)/9, k=1..9.
a((17*9^n - 9)/8) = 2*10^n - 1.
a((9^n - 1)/8 - 1) = 10^(n-1) - 1, n > 1.
Inequalities:
a(n) <= (1/9)*((8*n+1)^(1/log_10(9)) - 1), equality holds for n=(9^k-1)/8, k>0.
a(n) > (1/10)*((8*n+1)^(1/log_10(9)) - 1), n > 0.
Lower and upper limits:
lim inf a(n)/10^log_9(8*n) = 1/10, for n -> infinity.
lim inf a(n)/n^(1/log_10(9)) = 8^(1/log_10(9))/10, for n -> infinity.
lim sup a(n)/10^log_9(8*n) = 1/9, for n -> infinity.
lim sup a(n)/n^(1/log_10(9)) = 8^(1/log_10(9))/9, for n -> infinity.
G.f.: g(x) = (x^(1/8)*(1-x))^(-1) Sum_{j>=0} 10^j*z(j)^(9/8)*(1 - 10z(j)^9 + 9z(j)^10)/((1-z(j))(1-z(j)^9)), where z(j) = x^9^j.
Also: g(x) = (1/(1-x)) Sum_{j>=0} (1 - 10(x^9^j)^9 + 9(x^9^j)^10)*x^9^j*f_j(x)/(1-x^9^j), where f_j(x) = 10^j*x^((9^j-1)/8)/(1-(x^9^j)^9). Here, the f_j obey the recurrence f_0(x) = 1/(1-x^9), f_(j+1)(x) = 10x*f_j(x^9).
Also: g(x) = (1/(1-x))*((Sum{k=0..8} h_(9,k)(x)) - 9*h_(9,9)(x)), where h_(9,k)(x) = Sum_{j>=0} 10^j*x^((9^(j+1)-1)/8)*x^(k*9^j)/(1-x^9^(j+1)).
Generic formulas for analogous sequences with numbers expressed in base p and only using the digits 1, 2, 3, ... d, where 1 < d < p:
a(n) = Sum_{j=0..m-1} (1 + b(j) mod d)*p^j, where m = floor(log_d((d-1)*n+1)), b(j) = floor(((d-1)*n+1-d^m)/((d-1)*d^j)).
Special values:
a(k*(d^n-1)/(d-1)) = k*(10^n-1)/9, k=1..d.
a(d*((2d-1)*d^(n-1)-1)/(d-1)) = ((d+9)*10^n-d)/9 = 10^n + d*(10^n-1)/9.
a((d^n-1)/(d-1)-1) = d*(10^(n-1)-1)/9, n > 1.
Inequalities:
a(n) <= (10^log_d((d-1)*n+1)-1)/9, equality holds for n = (d^k-1)/(d-1), k > 0.
a(n) > (d/10)*(10^log_d((d-1)*n+1)-1)/9, n > 0.
Lower and upper limits:
lim inf a(n)/10^log_d((d-1)*n) = d/90, for n -> infinity.
lim sup a(n)/10^log_d((d-1)*n) = 1/9, for n -> infinity.
G.f.: g(x) = (1/(1-x)) Sum_{j>=0} (1 - (d+1)(x^d^j)^d + d(x^d^j)^(d+1))*x^d^j*f_j(x)/(1-x^d^j), where f_j(x) = p^j*x^((d^j-1)/(d-1))/(1-(x^d^j)^d). Here, the f_j obey the recursion f_0(x) = 1/(1-x^d), f_(j+1)(x) = px*f_j(x^d).
(End)
A052382 = { n | A054054(n) > 0 }. - M. F. Hasler, Jan 23 2013
From Hieronymus Fischer, Feb 20 2019: (Start)
Sum_{n>=1} (-1)^(n+1)/a(n) = 0.696899720...
Sum_{n>=1} 1/a(n)^2 = 1.6269683705819...
Sum_{n>=1} 1/a(n) = 23.1034479... = A082839. This so-called Kempner series converges very slowly. For the calculation of the sum, it is helpful to use the following fraction of partial sums, which converges rapidly:
lim_{n->infinity} (Sum_{k=p(n)..p(n+1)-1} 1/a(k)) / (Sum_{k=p(n-1)..p(n)-1} 1/a(k)) = 9/10, where p(n) = (9^n-1)/8, n > 1.
(End)

Extensions

Typos in formula section corrected by Hieronymus Fischer, May 30 2012
Name clarified by Peter Luschny, Jun 20 2025

A019546 Primes whose digits are primes; primes having only {2, 3, 5, 7} as digits.

Original entry on oeis.org

2, 3, 5, 7, 23, 37, 53, 73, 223, 227, 233, 257, 277, 337, 353, 373, 523, 557, 577, 727, 733, 757, 773, 2237, 2273, 2333, 2357, 2377, 2557, 2753, 2777, 3253, 3257, 3323, 3373, 3527, 3533, 3557, 3727, 3733, 5227, 5233, 5237, 5273, 5323, 5333, 5527, 5557
Offset: 1

Views

Author

R. Muller

Keywords

Comments

Intersection of A046034 and A000040; A055642(a(n)) = A193238(a(n)). - Reinhard Zumkeller, Jul 19 2011
Ribenboim mentioned in 2000 the following number as largest known term: 72323252323272325252 * (10^3120 - 1) / (10^20 - 1) + 1. It has 3120 digits, and was discovered by Harvey Dubner in 1992. Larger terms are 22557252272*R(15600)/R(10) and 2255737522*R(15600) where R(n) denotes the n-th repunit (see A002275): Both have 15600 digits and were found in 2002, also by Dubner (see Weisstein link). David Broadhurst reports in 2003 an even longer number with 82000 digits: (10^40950+1) * (10^20055+1) * (10^10374 + 1) * (10^4955 + 1) * (10^2507 + 1) * (10^1261 + 1) * (3*R(1898) + 555531001*10^940 - R(958)) + 1, see link. - Reinhard Zumkeller, Jan 13 2012
The smallest and largest primes that use exactly once the four prime decimal digits are respectively a(27)= 2357 and a(54) = 7523. - Bernard Schott, Apr 27 2023

References

  • Paulo Ribenboim, Prime Number Records (Chap 3), in 'My Numbers, My Friends', Springer-Verlag 2000 NY, page 76.

Crossrefs

Cf. A020463 (subsequence).
A093162, A093164, A093165, A093168, A093169, A093672, A093674, A093675, A093938 and A093941 are subsequences. - XU Pingya, Apr 20 2017

Programs

  • Haskell
    a019546 n = a019546_list !! (n-1)
    a019546_list = filter (all (`elem` "2357") . show )
                          ([2,3,5] ++ (drop 2 a003631_list))
    -- Or, much more efficient:
    a019546_list = filter ((== 1) . a010051) $
                          [2,3,5,7] ++ h ["3","7"] where
       h xs = (map read xs') ++ h xs' where
         xs' = concat $ map (f xs) "2357"
         f xs d = map (d :) xs
    -- Reinhard Zumkeller, Jul 19 2011
    
  • Magma
    [p: p in PrimesUpTo(5600) | Set(Intseq(p)) subset [2,3,5,7]]; // Bruno Berselli, Jan 13 2012
    
  • Mathematica
    Select[Prime[Range[700]], Complement[IntegerDigits[#], {2, 3, 5, 7}] == {} &] (* Alonso del Arte, Aug 27 2012 *)
    Select[Prime[Range[700]], AllTrue[IntegerDigits[#], PrimeQ] &] (* Ivan N. Ianakiev, Jun 23 2018 *)
    Select[Flatten[Table[FromDigits/@Tuples[{2,3,5,7},n],{n,4}]],PrimeQ] (* Harvey P. Dale, Apr 05 2025 *)
  • PARI
    is_A019546(n)=isprime(n) & !setminus(Set(Vec(Str(n))),Vec("2357")) \\ M. F. Hasler, Jan 13 2012
    
  • PARI
    print1(2); for(d=1,4, forstep(i=1,4^d-1,[1,1,2], p=sum(j=0,d-1,10^j*[2,3,5,7][(i>>(2*j))%4+1]); if(isprime(p), print1(", "p)))) \\ Charles R Greathouse IV, Apr 29 2015
    
  • Python
    from itertools import product
    from sympy import isprime
    A019546_list = [2,3,5,7]+[p for p in (int(''.join(d)+e) for l in range(1,5) for d in product('2357',repeat=l) for e in '37') if isprime(p)] # Chai Wah Wu, Jun 04 2021

Extensions

More terms from Cino Hilliard, Aug 06 2006
Thanks to Charles R Greathouse IV and T. D. Noe for massive editing support.

A007931 Numbers that contain only 1's and 2's. Nonempty binary strings of length n in lexicographic order.

Original entry on oeis.org

1, 2, 11, 12, 21, 22, 111, 112, 121, 122, 211, 212, 221, 222, 1111, 1112, 1121, 1122, 1211, 1212, 1221, 1222, 2111, 2112, 2121, 2122, 2211, 2212, 2221, 2222, 11111, 11112, 11121, 11122, 11211, 11212, 11221, 11222, 12111, 12112, 12121, 12122
Offset: 1

Views

Author

R. Muller

Keywords

Comments

Numbers written in the dyadic system [Smullyan, Stillwell]. - N. J. A. Sloane, Feb 13 2019
Logic-binary sequence: prefix it by the empty word to have all binary words on the alphabet {1,2}.
The least binary word of length k is a(2^k - 1).
See Mathematica program for logic-binary sequence using (0,1) in place of (1,2); the sequence starts with 0,1,00,01,10. - Clark Kimberling, Feb 09 2012
A007953(a(n)) = A014701(n+1); A007954(a(n)) = A048896(n). - Reinhard Zumkeller, Oct 26 2012
a(n) is n written in base 2 where zeros are not allowed but twos are. The two distinct digits used are 1, 2 instead of 0, 1. To obtain this sequence from the "canonical" base 2 sequence with zeros allowed, just replace any 0 with a 2 and then subtract one from the group of digits situated on the left: (10-->2; 100-->12; 110-->22; 1000-->112; 1010-->122). - Robin Garcia, Jan 31 2014
For numbers made of only two different digits, see also A007088 (digits 0 & 1), A032810 (digits 2 & 3), A032834 (digits 3 & 4), A256290 (digits 4 & 5), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340(digits 7 & 8), A256341 (digits 8 & 9), and A032804-A032816 (in other bases). Numbers with exactly two distinct (but unspecified) digits in base 10 are listed in A031955, for other bases in A031948-A031954. - M. F. Hasler, Apr 04 2015
The variant with digits {0, 1} instead of {1, 2} is obtained by deleting all initial digits in sequence A007088 (numbers written in base 2). - M. F. Hasler, Nov 03 2020

Examples

			Positive numbers may not start with 0 in the OEIS, otherwise this sequence would have been written as: 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 00000, 00001, 00010, 00011, 00100, 00101, 00110, 00111, 01000, 01001, 01010, 01011, ...
From _Hieronymus Fischer_, Jun 06 2012: (Start)
a(10)   = 122.
a(100)  = 211212.
a(10^3) = 222212112.
a(10^4) = 1122211121112.
a(10^5) = 2111122121211112.
a(10^6) = 2221211112112111112.
a(10^7) = 11221112112122121111112.
a(10^8) = 12222212122221111211111112.
a(10^9) = 22122211221212211212111111112. (End)
		

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 2. - From N. J. A. Sloane, Jul 26 2012
  • K. Atanassov, On the 97th, 98th and the 99th Smarandache Problems, Notes on Number Theory and Discrete Mathematics, Sophia, Bulgaria, Vol. 5 (1999), No. 3, 89-93.
  • R. M. Smullyan, Theory of Formal Systems, Princeton, 1961.
  • John Stillwell, Reverse Mathematics, Princeton, 2018. See p. 90.

Crossrefs

Cf. A007932 (digits 1-3), A059893, A045670, A052382 (digits 1-9), A059939, A059941, A059943, A032924, A084544, A084545, A046034 (prime digits 2,3,5,7), A089581, A084984 (no prime digits); A001742, A001743, A001744: loops; A202267 (digits 0, 1 and primes), A202268 (digits 1,4,6,8,9), A014261 (odd digits), A014263 (even digits).
Cf. A007088 (digits 0 & 1), A032810 (digits 2 & 3), A032834 (digits 3 & 4), A256290 (digits 4 & 5), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9), and A032804-A032816 (in other bases).
Cf. A020450 (primes).

Programs

  • Haskell
    a007931 n = f (n + 1) where
       f x = if x < 2 then 0 else (10 * f x') + m + 1
         where (x', m) = divMod x 2
    -- Reinhard Zumkeller, Oct 26 2012
    
  • Magma
    [n: n in [1..100000] | Set(Intseq(n)) subset {1,2}]; // Vincenzo Librandi, Aug 19 2016
    
  • Maple
    # Maple program to produce the sequence:
    a:= proc(n) local m, r, d; m, r:= n, 0;
          while m>0 do d:= irem(m, 2, 'm');
            if d=0 then d:=2; m:= m-1 fi;
            r:= d, r
          od; parse(cat(r))/10
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Aug 26 2016
    # Maple program to invert this sequence: given a(n), it returns n. - N. J. A. Sloane, Jul 09 2012
    invert7931:=proc(u)
    local t1,t2,i;
    t1:=convert(u,base,10);
    [seq(t1[i]-1,i=1..nops(t1))];
    [op(%),1];
    t2:=convert(%,base,2,10);
    add(t2[i]*10^(i-1),i=1..nops(t2))-1;
    end;
  • Mathematica
    f[n_] := FromDigits[Rest@IntegerDigits[n + 1, 2] + 1]; Array[f, 42] (* Robert G. Wilson v Sep 14 2006 *)
    (* Next, A007931 using (0,1) instead of (1,2) *)
    d[n_] := FromDigits[Rest@IntegerDigits[n + 1, 2] + 1]; Array[FromCharacterCode[ToCharacterCode[ToString[d[#]]] - 1] &, 100] (* Peter J. C. Moses, at request of Clark Kimberling, Feb 09 2012 *)
    Flatten[Table[FromDigits/@Tuples[{1,2},n],{n,5}]] (* Harvey P. Dale, Sep 13 2014 *)
  • PARI
    apply( {A007931(n)=fromdigits([d+1|d<-binary(n+1)[^1]])}, [1..44]) \\ M. F. Hasler, Nov 03 2020, replacing older code from Mar 26 2015
    
  • PARI
    /* inverse function */ apply( {A007931_inv(N)=fromdigits([d-1|d<-digits(N)],2)+2<M. F. Hasler, Nov 09 2020
    
  • Python
    def a(n): return int(bin(n+1)[3:].replace('1', '2').replace('0', '1'))
    print([a(n) for n in range(1, 45)]) # Michael S. Branicky, May 13 2021
    
  • Python
    def A007931(n): return int(s:=bin(n+1)[3:])+(10**(len(s))-1)//9 # Chai Wah Wu, Jun 13 2025

Formula

To get a(n), write n+1 in base 2, remove initial 1, add 1 to all remaining digits: e.g., eleven (11) in base 2 is 1011; remove initial 1 and add 1 to remaining digits: a(10)=122. - Clark Kimberling, Mar 11 2003
Conversely, given a(n), to get n: subtract 1 from all digits, prefix with an initial 1, convert this binary number to base 10, subtract 1. E.g., a(6)=22 -> 11 -> 111 -> 7 -> 6. - N. J. A. Sloane, Jul 09 2012
a(n) = A053645(n+1)+A002275(A000523(n)) = a(n-2^b(n))+10^b(n) where b(n) = A059939(n) = floor(log_2(n+1)-1). - Henry Bottomley, Feb 14 2001
From Hieronymus Fischer, Jun 06 2012 and Jun 08 2012: (Start)
The formulas are designed to calculate base-10 numbers only using the digits 1 and 2.
a(n) = Sum_{j=0..m-1} (1 + b(j) mod 2)*10^j, where m = floor(log_2(n+1)), b(j) = floor((n+1-2^m)/(2^j)).
Special values:
a(k*(2^n-1)) = k*(10^n-1)/9, k= 1,2.
a(3*2^n-2) = (11*10^n-2)/9 = 10^n+2*(10^n-1)/9.
a(2^n-2) = 2*(10^(n-1)-1)/9, n>1.
Inequalities:
a(n) <= (10^log_2(n+1)-1)/9, equality holds for n=2^k-1, k>0.
a(n) > (2/10)*(10^log_2(n+1)-1)/9.
Lower and upper limits:
lim inf a(n)/10^log_2(n) = 1/45, for n --> infinity.
lim sup a(n)/10^log_2(n) = 1/9, for n --> infinity.
G.f.: g(x) = (1/(x(1-x)))*sum_{j=0..infinity} 10^j* x^(2*2^j)*(1 + 2 x^2^j)/(1 + x^2^j).
Also: g(x) = (1/(1-x))*(h_(2,0)(x) + h_(2,1)(x) - 2*h_(2,2)(x)), where h_(2,k)(x) = sum_{j>=0} 10^j*x^(2^(j+1)-1)*x^(k*2^j)/(1-x^2^(j+1)).
Also: g(x) = (1/(1-x)) sum_{j>=0} (1 - 3(x^2^j)^2 + 2(x^2^j)^3)*x^2^j*f_j(x)/(1-x^2^j), where f_j(x) = 10^j*x^(2^j-1)/(1-(x^2^j)^2). The f_j obey the recurrence f_0(x) = 1/(1-x^2), f_(j+1)(x) = 10x*f_j(x^2). (End)

Extensions

Some crossrefs added by Hieronymus Fischer, Jun 06 2012
Edited by M. F. Hasler, Mar 26 2015

A014261 Numbers that contain odd digits only.

Original entry on oeis.org

1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 31, 33, 35, 37, 39, 51, 53, 55, 57, 59, 71, 73, 75, 77, 79, 91, 93, 95, 97, 99, 111, 113, 115, 117, 119, 131, 133, 135, 137, 139, 151, 153, 155, 157, 159, 171, 173, 175, 177, 179, 191, 193, 195, 197, 199, 311, 313, 315, 317, 319
Offset: 1

Views

Author

Keywords

Comments

Or, numbers whose product of digits is odd.
Complement of A007928; A196563(a(n)) = 0. - Reinhard Zumkeller, Oct 04 2011
If n is represented as a zerofree base-5 number (see A084545) according to n = d(m)d(m-1)...d(3)d(2)d(1)d(0) then a(n) = Sum_{j = 0..m} c(d(j))*10^j, where c(k) = 1, 3, 5, 7, 9 for k = 1..5. - Hieronymus Fischer, Jun 06 2012

Examples

			a(10^3) = 13779.
a(10^4) = 397779.
a(10^5) = 11177779.
a(10^6) = 335777779.
		

Crossrefs

Subsequence of A059708 and of A225985. A066640 and A030096 are subsequences.

Programs

  • Haskell
    a014261 n = a014261_list !! (n-1)
    a014261_list = filter (all (`elem` "13579") . show) [1,3..]
    -- Reinhard Zumkeller, Jul 05 2011
    
  • Magma
    [ n : n in [1..129] | IsOdd(&*Intseq(n,10)) ];
    
  • Mathematica
    Select[Range[400], OddQ[Times@@IntegerDigits[#]] &] (* Alonso del Arte, Feb 21 2014 *)
  • PARI
    is(n)=Set(digits(n)%2)==[1] \\ Charles R Greathouse IV, Jul 06 2017
    
  • PARI
    a(n)={my(k=1); while(n>5^k, n-=5^k; k++); fromdigits([2*d+1 | d<-digits(5^k+n-1, 5)]) - 3*10^k} \\ Andrew Howroyd, Jan 17 2020
    
  • Python
    from itertools import islice, count
    def A014261(): return filter(lambda n: set(str(n)) <= {'1','3','5','7','9'}, count(1,2))
    A014261_list = list(islice(A014261(),20)) # Chai Wah Wu, Nov 22 2021
    
  • Python
    from itertools import count, islice, product
    def agen(): yield from (int("".join(p)) for d in count(1) for p in product("13579", repeat=d))
    print(list(islice(agen(), 60))) # Michael S. Branicky, Jan 13 2022

Formula

A121759(a(n)) = a(n); A000035(A007959(a(n))) = 1. - Reinhard Zumkeller, Nov 30 2007
From Reinhard Zumkeller, Aug 30 2009: (Start)
a(n+1) - a(n) = A164898(n). - Reinhard Zumkeller, Aug 30 2009
a(n+1) = h(a(n)) with h(x) = 1 + (if x mod 10 < 9 then x + x mod 2 else 10*h(floor(x/10)));
a(n) = f(n, 1) where f(n, x) = if n = 1 then x else f(n-1, h(x)). (End)
From Hieronymus Fischer, Jun 06 2012: (Start)
a(n) = Sum_{j = 0..m-1} ((2*b_j(n)+1) mod 10)*10^j, where b_j(n) = floor((4*n+1-5^m)/(4*5^j)), m = floor(log_5(4*n+1)).
a(1*(5^n-1)/4) = 1*(10^n-1)/9.
a(2*(5^n-1)/4) = 1*(10^n-1)/3.
a(3*(5^n-1)/4) = 5*(10^n-1)/9.
a(4*(5^n-1)/4) = 7*(10^n-1)/9.
a(5*(5^n-1)/4) = 10^n - 1.
a((5^n-1)/4 + 5^(n-1)-1) = (10^n-5)/5.
a(n) = (10^log_5(4*n+1)-1)/9 for n = (5^k-1)/4, k > 0.
a(n) < (10^log_5(4*n+1)-1)/9 for (5^k-1)/4 < n < (5^(k+1)-1)/4, k > 0.
a(n) <= 27/(9*2^log_5(9)-1)*(10^log_5(4*n+1)-1)/9 for n > 0, equality holds for n = 2.
a(n) > 0.776*10^log_5(4*n+1)-1)/9 for n > 0.
a(n) >= A001742(n), equality holds for n = (5^k-1)/4, k > 0.
a(n) = A084545(n) if and only if all digits of A084545(n) are 1, else a(n) > A084545(n).
G.f.: g(x)= (x^(1/4)*(1-x))^(-1) Sum_{j >= 0} 10^j*z(j)^(5/4)*(1-z(j))*(1 + 3*z(j) + 5*z(j)^2 + 7*z(j)^3 + 9*z(j)^4)/(1-z(j)^5), where z(j) = x^5^j.
Also: g(x) = (1/(1-x))*(h_(5,0)(x) + 2*h_(5,1)(x) + 2*h_(5,2)(x) + 2*h_(5,3)(x) + 2*h_(5,4)(x) - 9*h_(5,5)(x)), where h_(5,k)(x) = Sum_{j >= 0} 10^j*x^((5^(j+1)-1)/4)*(x^5^j)^k/(1-(x^5^j)^5). (End)
a(n) = A225985(A226091(n)). - Reinhard Zumkeller, May 26 2013
Sum_{n>=1} 1/a(n) = A194181. - Bernard Schott, Jan 13 2022

Extensions

More terms from Robert G. Wilson v, Oct 18 2002
Examples and crossrefs added by Hieronymus Fischer, Jun 06 2012

A014263 Numbers that contain even digits only.

Original entry on oeis.org

0, 2, 4, 6, 8, 20, 22, 24, 26, 28, 40, 42, 44, 46, 48, 60, 62, 64, 66, 68, 80, 82, 84, 86, 88, 200, 202, 204, 206, 208, 220, 222, 224, 226, 228, 240, 242, 244, 246, 248, 260, 262, 264, 266, 268, 280, 282, 284, 286, 288, 400, 402, 404, 406, 408, 420, 422, 424
Offset: 1

Views

Author

Keywords

Comments

The set of real numbers between 0 and 1 that contain no odd digits in their decimal expansion has Hausdorff dimension log 5 / log 10.
Integers written in base 5 and then doubled (in base 10). - Franklin T. Adams-Watters, Mar 15 2006
The carryless mod 10 "even" numbers (cf. A004529) sorted and duplicates removed. - N. J. A. Sloane, Aug 03 2010.
Complement of A007957; A196564(a(n)) = 0; A103181(a(n)) = 0. - Reinhard Zumkeller, Oct 04 2011
If n-1 is represented as a base-5 number (see A007091) according to n-1 = d(m)d(m-1)…d(3)d(2)d(1)d(0) then a(n)= Sum_{j=0..m} c(d(j))*10^j, where c(k)=0,2,4,6,8 for k=0..4. - Hieronymus Fischer, Jun 03 2012

Examples

			a(1000) = 24888.
a(10^4) = 60888.
a(10^5) = 22288888.
a(10^6) = 446888888.
		

References

  • K. J. Falconer, The Geometry of Fractal Sets, Cambridge, 1985; p. 19.

Crossrefs

Programs

  • Haskell
    a014263 n = a014263_list !! (n-1)
    a014263_list = filter (all (`elem` "02468") . show) [0,2..]
    -- Reinhard Zumkeller, Jul 05 2011
    
  • Magma
    [n: n in [0..424] | Set(Intseq(n)) subset [0..8 by 2]];  // Bruno Berselli, Jul 19 2011
    
  • Maple
    a:= proc(m) local L,i;
      L:= convert(m-1,base,5);
      2*add(L[i]*10^(i-1),i=1..nops(L))
    end proc:
    seq(a(i),i=1..100); # Robert Israel, Apr 07 2016
  • Mathematica
    Select[Range[450], And@@EvenQ[IntegerDigits[#]]&] (* Harvey P. Dale, Jan 30 2011 *)
    FromDigits/@Tuples[{0,2,4,6,8},3] (* Harvey P. Dale, Jul 07 2025 *)
  • PARI
    a(n) = 2*fromdigits(digits(n-1, 5), 10); \\ Michel Marcus, Nov 04 2022
    
  • PARI
    is(n)=#setminus(Set(digits(n)), [0,2,4,6,8])==0 \\ Charles R Greathouse IV, Mar 03 2025
  • Python
    from sympy.ntheory.digits import digits
    def a(n): return int(''.join(str(2*d) for d in digits(n, 5)[1:]))
    print([a(n) for n in range(58)]) # Michael S. Branicky, Jan 13 2022
    
  • Python
    from itertools import count, islice, product
    def agen(): # generator of terms
        yield 0
        for d in count(1):
            for first in "2468":
                for rest in product("02468", repeat=d-1):
                    yield int(first + "".join(rest))
    print(list(islice(agen(), 58))) # Michael S. Branicky, Jan 13 2022
    

Formula

A045888(a(n)) = 0. - Reinhard Zumkeller, Aug 25 2009
a(n) = A179082(n) for n <= 25. - Reinhard Zumkeller, Jun 28 2010
From Hieronymus Fischer, Jun 06 2012: (Start)
a(n) = ((2*b_m(n)) mod 8 + 2)*10^m + Sum_{j=0..m-1} ((2*b_j(n)) mod 10)*10^j, where n>1, b_j(n) = floor((n-1-5^m)/5^j), m = floor(log_5(n-1)).
a(1*5^n+1) = 2*10^n.
a(2*5^n+1) = 4*10^n.
a(3*5^n+1) = 6*10^n.
a(4*5^n+1) = 8*10^n.
a(n) = 2*10^log_5(n-1) for n=5^k+1,
a(n) < 2*10^log_5(n-1), else.
a(n) > (8/9)*10^log_5(n-1) n>1.
a(n) = 2*A007091(n-1), iff the digits of A007091(n-1) are 0 or 1.
G.f.: g(x) = (x/(1-x))*Sum_{j>=0} 10^j*x^5^j *(1-x^5^j)* (2+4x^5^j+ 6(x^2)^5^j+ 8(x^3)^5^j)/(1-x^5^(j+1)).
Also: g(x) = 2*(x/(1-x))*Sum_{j>=0} 10^j*x^5^j * (1-4x^(3*5^j)+3x^(4*5^j))/((1-x^5^j)(1-x^5^(j+1))).
Also: g(x) = 2*(x/(1-x))*(h_(5,1)(x) + h_(5,2)(x) + h_(5,3)(x) + h_(5,4)(x) - 4*h_(5,5)(x)), where h_(5,k)(x) = Sum_{j>=0} 10^j*(x^5^j)^k/(1-(x^5^j)^5). (End)
a(5*n+i-4) = 10*a(n) + 2*i for n >= 1, i=0..4. - Robert Israel, Apr 07 2016
Sum_{n>=2} 1/a(n) = A194182. - Bernard Schott, Jan 13 2022

Extensions

Examples and crossrefs added by Hieronymus Fischer, Jun 06 2012

A196564 Number of odd digits in decimal representation of n.

Original entry on oeis.org

0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 04 2011

Keywords

Crossrefs

Programs

  • Haskell
    a196564 n = length [d | d <- show n, d `elem` "13579"]
    -- Reinhard Zumkeller, Feb 22 2012, Oct 04 2011
    
  • Maple
    A196564 := proc(n)
            if n =0 then
                    0;
            else
                    convert(n,base,10) ;
                    add(d mod 2,d=%) ;
            end if:
    end proc: # R. J. Mathar, Jul 13 2012
  • Mathematica
    Table[Total[Mod[IntegerDigits[n],2]],{n,0,100}] (* Zak Seidov, Oct 13 2015 *)
  • PARI
    a(n) = #select(x->x%2, digits(n)); \\ Michel Marcus, Oct 14 2015
    
  • Python
    def a(n): return sum(1 for d in str(n) if d in "13579")
    print([a(n) for n in range(100)]) # Michael S. Branicky, May 15 2022

Formula

a(n) = A055642(n) - A196563(n);
a(A014263(n)) = 0; a(A007957(n)) > 0.
From Hieronymus Fischer, May 30 2012: (Start)
a(n) = Sum_{j=0..m} (floor(n/(2*10^j) + (1/2)) - floor(n/(2*10^j))), where m=floor(log_10(n)).
a(10*n+k) = a(n) + a(k), 0<=k<10, n>=0.
a(n) = a(floor(n/10)) + a(n mod 10), n>=0.
a(n) = Sum_{j=0..m} a(floor(n/10^j) mod 10), n>=0.
a(A014261(n)) = floor(log_5(4*n+1)), n>0.
G.f.: g(x) = (1/(1-x))*Sum_{j>=0} x^10^j/(1+x^10^j). (End)

A211681 Numbers such that all the substrings of length <= 2 are primes.

Original entry on oeis.org

2, 3, 5, 7, 23, 37, 53, 73, 237, 373, 537, 737, 2373, 3737, 5373, 7373, 23737, 37373, 53737, 73737, 237373, 373737, 537373, 737373, 2373737, 3737373, 5373737, 7373737, 23737373, 37373737, 53737373, 73737373, 237373737, 373737373, 537373737, 737373737
Offset: 1

Views

Author

Hieronymus Fischer, Apr 30 2012

Keywords

Comments

The terms are primes for n = 1, 2, 3, 4, 5, 6, 7, 8, 10, 21, 23, 27, 31, 43, 45, 60, 67, 82, 91, .... The further terms until index 102 are composite. For the subsequence with prime terms see A211682. - [updated by Hieronymus Fischer, Oct 02 2018]
From Hieronymus Fischer, Oct 02 2018: (Start)
For indices n > 8, prime terms satisfy n mod 24 = 1, 3, 5, 7, 10, 12, 19, 21, 23. However, this condition is not sufficient. Indeed, for n <= 200 most of those terms are proven composite unless the terms with n = 103, 106, 123, 156, 165, 175, 178, 191, 193 and 195 which are potentially prime.
The terms are composite for n > 10 and n mod 24 = 0, 2, 4, 6, 8, 9, 11, 13, 14, 15, 16, 17, 18, 20, 22 (see formula section for the details).
(End)
Cf. A213299 for the partial sums.

Examples

			a(11)=537, since all substrings of length <= 2 are primes (5, 3, 7, 53 and 37).
a(21)=237373, the substrings of length <= 2 are 2, 3, 7, 23, 37, 73.
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits/@Select[Tuples[{2,3,5,7},n],AllTrue[FromDigits/@ Partition[ #,2,1],PrimeQ]&],{n,9}]//Flatten (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 13 2020 *)

Formula

a(1+8*k) = 2*10^(2k) + 37*(10^(2k)-1)/99,
a(2+8*k) = 3*10^(2k) + 73*(10^(2k)-1)/99,
a(3+8*k) = 5*10^(2k) + 37*(10^(2k)-1)/99,
a(4+8*k) = 7*10^(2k) + 37*(10^(2k)-1)/99,
a(5+8*k) = 23*10^(2k) + 73*(10^(2k)-1)/99,
a(6+8*k) = 37*10^(2k) + 37*(10^(2k)-1)/99,
a(7+8*k) = 53*10^(2k) + 73*(10^(2k)-1)/99,
a(8+8*k) = 73*10^(2k) + 73*(10^(2k)-1)/99, for k >= 0.
a(n) = ((2*n+7) mod 8 + dn3 - dn2)*10^dn_1 + floor((37+36*(dn2-dn1))*10^dn_1/99), where dn1 = floor((n+1)/4), dn2 = floor((n+2)/4), dn3 = floor((n+3)/4), dn_1 = floor((n-1)/4). [updated by Hieronymus Fischer, Oct 02 2018]
From Hieronymus Fischer, Oct 02 2018: (Start)
a(24k + 0) = 73*(10^(6k-2) + (10^(6k-2)-1)/99), for k > 0.
a(24k + 2) = 3*(1245790*(10^(6k)-1)/999999 + 1),
a(24k + 4) = 7*(1053390*(10^(6k)-1)/999999 + 1),
a(24k + 6) = 37*(10^(6k) + (10^(6k)-1)/99),
a(24k + 8) = 73*(10^(6k) + (10^(6k)-1)/99),
a(24k + 9) = 3*(79124500*(10^(6k)-1)/999999 + 79),
a(24k + 11) = 3*(79124500*(10^(6k)-1)/999999 + 79 + 10^(6k+2)),
a(24k + 13) = 3*(791245000*(10^(6k)-1)/999999 + 791),
a(24k + 14) = 37*(10^(6k+2) + (10^(6k+2)-1)/99),
a(24k + 15) = 3*(791245000*(10^(6k)-1)/999999 + 791 + 10^(6k+3)),
a(24k + 16) = 73*(10^(6k+2) + (10^(6k+2)-1)/99),
a(24k + 17) = 7*(3391050000*(10^(6k)-1)/999999 + 3391),
a(24k + 18) = 7*(5339100000*(10^(6k)-1)/999999 + 5339),
a(24k + 20) = 3*(24579100000*(10^(6k)-1)/999999 + 24579),
a(24k + 22) = 37*(10^(6k+4) + (10^(6k+4)-1)/99), for k >= 0.
(End)
Recursion for n>8:
a(n) = 10*(1+a(n-4)) - a(n-4) mod 10.
G.f.: (2*x*(1+x^10) + 3*x^2*(1 + x^3 + x^5 + x^6) + 5*x^3*(1+x^6) + 7*x^4*(1+x^2))/((1-10*x^4)*(1-x^8)). [corrected by Hieronymus Fischer, Sep 03 2012]
From Chai Wah Wu, Feb 08 2023: (Start)
a(n) = a(n-1) + 9*a(n-4) - 9*a(n-5) + 10*a(n-8) - 10*a(n-9) for n > 9.
G.f.: x*(2*x^7 - 2*x^6 + 5*x^5 - 2*x^4 + 2*x^3 + 2*x^2 + x + 2)/((x - 1)*(x^4 + 1)*(10*x^4 - 1)). (End)

A196563 Number of even digits in decimal representation of n.

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 1, 2, 1, 2, 1
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 04 2011

Keywords

Crossrefs

Programs

  • Haskell
    a196563 n = length [d | d <- show n, d `elem` "02468"]
    -- Reinhard Zumkeller, Feb 22 2012, Oct 04 2011
    
  • Maple
    A196563 := proc(n)
            if n =0 then
                    1;
            else
                    convert(n,base,10) ;
                    add(1-(d mod 2),d=%) ;
            end if:
    end proc: # R. J. Mathar, Jul 13 2012
  • Mathematica
    Table[Count[Mod[IntegerDigits[n],2],0][n],{n,0,100}] (* Zak Seidov, Oct 13 2015 *)
    Table[Count[IntegerDigits[n],?EvenQ],{n,0,120}] (* _Harvey P. Dale, Feb 22 2020 *)
  • PARI
    a(n) = #select(x->(!(x%2)), if (n, digits(n), [0])); \\ Michel Marcus, Oct 14 2015
    
  • Python
    def a(n): return sum(1 for d in str(n) if d in "02468")
    print([a(n) for n in range(100)]) # Michael S. Branicky, May 15 2022

Formula

a(n) = A055642(n) - A196564(n);
a(A014261(n)) = 0; a(A007928(n)) > 0.
From Hieronymus Fischer, May 30 2012: (Start)
a(n) = Sum_{j=0..m} (1 + floor(n/(2*10^j)) - floor(n/(2*10^j) + (1/2))), where m=floor(log_10(n)).
a(10*n+k) = a(n) + a(k), 0<=k<10, n>=1.
a(n) = a(floor(n/10))+a(n mod 10), n>=10.
a(n) = Sum_{j=0..m} a(floor(n/10^j) mod 10), n>=0.
a(A014263(n)) = 1 + floor(log_5(n-1)), n>1.
G.f.: g(x) = 1 + (1/(1-x))*Sum_{j>=0} x^(2*10^j)/(1+x^10^j). (End)
Showing 1-10 of 103 results. Next