A144688 "Magic" numbers: all numbers from 0 to 9 are magic; a number >= 10 is magic if it is divisible by the number of its digits and the number obtained by deleting the final digit is also magic.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 102, 105, 108, 120, 123, 126, 129, 141, 144, 147, 162, 165, 168, 180
Offset: 1
Examples
102 has three digits, 102 is divisible by 3, and 10 is also magic, so 102 is a member.
References
- Robert Bosch, Tale of a Problem Solver, Arista Publishing, Miami FL, 2016.
- David Wells, The Penguin Dictionary of Curious and Interesting Numbers (Revised Edition), Penguin Books, 1997, entry 381654729, page 185.
Links
- Zak Seidov, The full table of n, a(n) for n=1..20457
- James Grime and Brady Haran, Why 381,654,729 is awesome, Numberphile video (2013).
- Shyam Sunder Gupta, On Some Special Numbers, Exploring the Beauty of Fascinating Numbers, Springer (2025) Ch. 22, 527-565.
- Wikipedia, Polydivisible number
Programs
-
Maple
P1:={seq(i,i=1..9)}: for i from 2 to 25 do P||i:={}: for n from 1 to nops(P||(i-1)) do for j from 0 to 9 do if P||(i-1)[n]*10+j mod i = 0 then P||i:={op(P||i),P||(i-1)[n]*10+j}: fi: od: od: od: `union`({0},seq(P||i,i=1..25)); # Martin Renner, Mar 05 2016
-
Mathematica
divQ[n_]:=Divisible[n,IntegerLength[n]]; lessQ[n_]:=FromDigits[Most[IntegerDigits[n]]]; pdQ[n_]:=If[Or[n<10,And[divQ[n],divQ[lessQ[n]]]],True]; Select[Range[0,180],pdQ[#]&] (* Ivan N. Ianakiev, Aug 23 2016 *)
-
Python
def agen(): # generator of terms yield 0 magic, biggermagic, digits = list(range(1, 10)), [], 2 while len(magic) > 0: yield from magic for i in magic: for d in range(10): t = 10*i + d if t%digits == 0: biggermagic.append(t) magic, biggermagic, digits = biggermagic, [], digits+1 print([an for an in agen()][:70]) # Michael S. Branicky, Feb 07 2022
Comments