login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A081229 a(n) is the sum of the common digits of n and the n-th prime in base 10, or -1 if there are no common digits. 3
-1, -1, -1, -1, -1, -1, 7, -1, -1, -1, 1, -1, 1, 4, -1, -1, -1, 1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, 9, 3, 1, 3, 3, 3, -1, -1, 7, 3, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, 5, 5, 6, -1, -1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 7, 7, -1, -1, 7, -1, 0, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 9, -1, 13, 9, -1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,7
COMMENTS
Repeated digits are to be ignored; e.g. 2001 and 4050 have only one digit in common, 0.
LINKS
EXAMPLE
a(73)=10 since the 73rd prime is 367 (3+7=10).
MAPLE
digcomp := proc(A, B) local a, b, crit, f; description "returns the digits that 'A' and 'B' have in common; if a third argument is given and it is 'sum' then the sum of the common digits is returned, else if it is 'num' then the number of common digits is returned."; if nargs>2 then crit := args[3] else crit := NULL fi; a := convert(`if`(A=0, [0], (convert(A, base, 10))), set); b := convert(`if`(B=0, [0], (convert(B, base, 10))), set); f := a intersect b; if crit=sum then return `if`(nops(f)>0, `+`(op(f)), -1) elif crit=num then return nops(f) else return f; fi; end proc; F := ([seq(digcomp(i, ithprime(i), sum), i=1..75)]);
MATHEMATICA
scd[{a_, b_}]:=Module[{cd=Intersection[IntegerDigits[a], IntegerDigits[ b]]}, If[ cd=={}, -1, Total[cd]]]; With[{nn=100}, scd/@ Thread[{Range[ nn], Prime[ Range[ nn]]}]] (* Harvey P. Dale, Apr 25 2017 *)
PROG
(PARI) digitset(n) = local(v, d); v=[]; while(n>0, d=divrem(n, 10); n=d[1]; v=concat(d[2], v)); Set(v)
{for(n=1, 94, s=setintersect(digitset(n), digitset(prime(n))); v=eval(s); print1(if(v==[], -1, sum(j=1, #v, v[j])), ", "))} [Klaus Brockhaus, Dec 19 2006]
CROSSREFS
Sequence in context: A304906 A055061 A074465 * A109010 A268354 A117825
KEYWORD
base,sign
AUTHOR
Francois Jooste (pin(AT)myway.com), Mar 11 2003
EXTENSIONS
Entries checked by Klaus Brockhaus, Dec 19 2006
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 04:56 EDT 2024. Contains 371767 sequences. (Running on oeis4.)